a78753d392
* Updating to v3 API * General fixes * Extending dimension bits to 54 * Disabling agent profiling tests * Fixed unit test * Adding accumulate metric support for parsing counters (#609) * Adding accumulate metric support for parsing counters * Adding metric flag * Updating tests * source formatting (clang-format v11) (#610) Co-authored-by: Manjunath-Jakaraddi <21177428+Manjunath-Jakaraddi@users.noreply.github.com> * source formatting (clang-format v11) (#614) Co-authored-by: jrmadsen <6001865+jrmadsen@users.noreply.github.com> * Adding evaluate ast test * source formatting (clang-format v11) (#633) Co-authored-by: Manjunath-Jakaraddi <21177428+Manjunath-Jakaraddi@users.noreply.github.com> * Update scanner generated file * Adding flags to events for aqlprofile * Fix Mi200 failing test --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Manjunath-Jakaraddi <21177428+Manjunath-Jakaraddi@users.noreply.github.com> Co-authored-by: jrmadsen <6001865+jrmadsen@users.noreply.github.com> * Revert "Extending dimension bits to 54" This reverts commit 3cd6628452484044a93e129f27974f996a0e4c08. * Removing CU dimension * Fixing merge conflicts * Revert "Disabling agent profiling tests" This reverts commit 7e01518ed8c51fbb0c3b2575e1e0b8f9ddfa8237. * Fixing merge conflicts * Fix parser tests * Adding accumulate metric documentation * Update counter_collection_services.md * Update index.md * fix nested expression use * Update source/lib/rocprofiler-sdk/counters/evaluate_ast.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Doc update --------- Co-authored-by: Benjamin Welton <ben@amd.com> Co-authored-by: Manjunath P Jakaraddi <manjunath180397@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Manjunath-Jakaraddi <21177428+Manjunath-Jakaraddi@users.noreply.github.com> Co-authored-by: jrmadsen <6001865+jrmadsen@users.noreply.github.com> Co-authored-by: Manjunath-Jakaraddi <manjunath.jakaraddi@amd.com>
108 строки
3.5 KiB
Plaintext
108 строки
3.5 KiB
Plaintext
%parse-param {RawAST** result}
|
|
%code requires {
|
|
#include "raw_ast.hpp"
|
|
using namespace rocprofiler::counters;
|
|
#define YYDEBUG 1
|
|
}
|
|
|
|
%{
|
|
#include <stdexcept>
|
|
#include <stdio.h>
|
|
#include <string>
|
|
|
|
#include "raw_ast.hpp"
|
|
|
|
int yyparse(rocprofiler::counters::RawAST** result);
|
|
int yylex(void);
|
|
void yyerror(rocprofiler::counters::RawAST**, const char *s) { ROCP_ERROR << s; }
|
|
%}
|
|
|
|
/* declare tokens */
|
|
%token ADD SUB MUL DIV ABS EQUALS
|
|
%token OP CP O_SQ C_SQ COLON
|
|
%token EOL
|
|
|
|
/* set associativity rules for operand tokens */
|
|
%right EQUALS
|
|
%left ADD SUB
|
|
%left MUL DIV
|
|
%nonassoc '|' UMINUS CM
|
|
|
|
/*declare data types*/
|
|
%union {
|
|
RawAST* a; /* For ast node */
|
|
LinkedList* ll; /* For linked list node */
|
|
int64_t d;
|
|
char* s;
|
|
}
|
|
|
|
%token NUMBER RANGE /* set data type for numbers */
|
|
%token NAME /* set data type for variables and user-defined functions */
|
|
%token REDUCE SELECT /* set data type for special functions */
|
|
%token ACCUMULATE
|
|
%type <a> exp /* set data type for expressions */
|
|
%type <s> NAME
|
|
%type <d> NUMBER
|
|
%type <ll> reduce_dim_args select_dim_args
|
|
|
|
%nonassoc LOWER_THAN_ELSE
|
|
%nonassoc ELSE
|
|
|
|
// %token <pos_int> POS_INTEGER
|
|
|
|
%%
|
|
|
|
top:
|
|
exp { *result = $1;};
|
|
|
|
|
|
exp: NUMBER { $$ = new RawAST(NUMBER_NODE, $1); }
|
|
| exp ADD exp { $$ = new RawAST(ADDITION_NODE, {$1, $3}); }
|
|
| exp SUB exp { $$ = new RawAST(SUBTRACTION_NODE, {$1, $3}); }
|
|
| exp MUL exp { $$ = new RawAST(MULTIPLY_NODE, {$1, $3}); }
|
|
| exp DIV exp { $$ = new RawAST(DIVIDE_NODE, {$1, $3}); }
|
|
| OP exp CP { $$ = $2; }
|
|
| NAME { $$ = new RawAST(REFERENCE_NODE, $1);
|
|
free($1);
|
|
}
|
|
| ACCUMULATE OP NAME CM NAME CP {
|
|
$$ = new RawAST(ACCUMULATE_NODE, $3, $5);
|
|
free($3);
|
|
free($5);
|
|
}
|
|
| REDUCE OP exp CM NAME CP {
|
|
$$ = new RawAST(REDUCE_NODE, $3, $5, NULL);
|
|
free($5);
|
|
}
|
|
| REDUCE OP exp CM NAME CM O_SQ reduce_dim_args C_SQ CP {
|
|
$$ = new RawAST(REDUCE_NODE, $3, $5, $8);
|
|
free($5);
|
|
}
|
|
| SELECT OP exp CM O_SQ select_dim_args C_SQ CP {
|
|
$$ = new RawAST(SELECT_NODE, $3, $6);
|
|
}
|
|
;
|
|
|
|
|
|
|
|
reduce_dim_args: NAME { $$ = new LinkedList($1, NULL);
|
|
free($1);
|
|
}
|
|
| NAME CM reduce_dim_args { $$ = new LinkedList($1, $3);
|
|
free($1);
|
|
}
|
|
;
|
|
|
|
|
|
|
|
select_dim_args: NAME EQUALS NUMBER { $$ = new LinkedList($1, $3, NULL);
|
|
free($1);
|
|
}
|
|
| NAME EQUALS NUMBER CM select_dim_args { $$ = new LinkedList($1, $3, $5);
|
|
free($1);
|
|
}
|
|
;
|
|
|
|
|
|
%%
|