Compute Library
 21.08
arm_compute::mlgo::parser Namespace Reference

Data Structures

struct  CharPosition
 
struct  Token
 Token. More...
 
class  TokenStream
 A stream of token. More...
 

Enumerations

enum  ComparatorType { Enum, Num, Var }
 
enum  TokenType {
  L_List = '[', R_List = ']', Int, Float,
  Text, End
}
 Type of Token. More...
 

Functions

void advance (CharPosition &pos, char ch)
 
void rewind (CharPosition &pos)
 
void end (TokenStream &in, bool &valid)
 
bool bool_val (TokenStream &in, bool &valid)
 
int int_val (TokenStream &in, bool &valid)
 
unsigned int uint_val (TokenStream &in, bool &valid)
 
float float_val (TokenStream &in, bool &valid)
 
std::string text_val (TokenStream &in, bool &valid)
 
bool accept_text (TokenStream &in, const std::string &c_str, bool take=true)
 
void expect_text (TokenStream &in, const std::string &str, bool &valid)
 
bool accept_l_list (TokenStream &in)
 
void expect_l_list (TokenStream &in, bool &valid)
 
bool accept_r_list (TokenStream &in)
 
void expect_r_list (TokenStream &in, bool &valid)
 
ConditionalOp conditional_op (TokenStream &in, bool &valid)
 
void gemm_version (TokenStream &in, bool &valid)
 
void ip_type (TokenStream &in, bool &valid)
 
void header (TokenStream &in, bool &valid)
 
DataType data_type (TokenStream &in, bool &valid)
 
ComparatorType comparator_type (TokenStream &in, bool &valid)
 
HeuristicType heuristic_type (TokenStream &in, bool &valid, bool take=true)
 
void expect_heuristic_type (TokenStream &in, HeuristicType expected_ht, bool &valid)
 
GEMMType gemm_type (TokenStream &in, bool &valid)
 
GEMMConfigNative gemm_config_native (TokenStream &in, bool &valid)
 
GEMMConfigReshapedOnlyRHS gemm_config_reshaped_only_rhs (TokenStream &in, bool &valid)
 
GEMMConfigReshaped gemm_config_reshaped (TokenStream &in, bool &valid)
 
void gpu_priority (TokenStream &in, bool &valid)
 
void gpu_behavior (TokenStream &in, bool &valid)
 
void free_vars (TokenStream &in, bool &valid)
 
void heuristics_table_entry (TokenStream &in, MLGOHeuristics &h, bool &valid)
 
void heuristics_table (TokenStream &in, MLGOHeuristics &h, bool &valid)
 
Condition condition (TokenStream &in, bool &valid)
 
void heuristic_tree (TokenStream &in, MLGOHeuristics &h, bool &valid)
 
MLGOHeuristics mlgo (TokenStream &in, bool &valid)
 
std::pair< bool, MLGOHeuristicsparse_mlgo (std::istream &in)
 Parse and construct a MLGOHeuristics from input stream. More...
 
std::ostream & operator<< (std::ostream &os, const CharPosition &pos)
 

Enumeration Type Documentation

◆ ComparatorType

◆ TokenType

enum TokenType
strong

Type of Token.

Enumerator
L_List 

List open.

R_List 

List close.

Int 

Integral.

Float 

Floating.

Text 

Text/String.

End 

End of stream.

Definition at line 84 of file MLGOParser.h.

85 {
86  L_List = '[', /**< List open */
87  R_List = ']', /**< List close */
88  Int, /**< Integral */
89  Float, /**< Floating */
90  Text, /**< Text/String */
91  End, /**< End of stream */
92 };

Function Documentation

◆ accept_l_list()

bool arm_compute::mlgo::parser::accept_l_list ( TokenStream in)

Definition at line 384 of file MLGOParser.cpp.

References L_List, TokenStream::peek(), and TokenStream::take().

Referenced by expect_l_list().

385 {
386  auto tok = in.peek();
387  if(tok.type == TokenType::L_List)
388  {
389  in.take();
390  return true;
391  }
392  return false;
393 }

◆ accept_r_list()

bool arm_compute::mlgo::parser::accept_r_list ( TokenStream in)

Definition at line 404 of file MLGOParser.cpp.

References TokenStream::peek(), R_List, and TokenStream::take().

Referenced by expect_r_list(), and free_vars().

405 {
406  auto tok = in.peek();
407  if(tok.type == TokenType::R_List)
408  {
409  in.take();
410  return true;
411  }
412  return false;
413 }

◆ accept_text()

bool arm_compute::mlgo::parser::accept_text ( TokenStream in,
const std::string &  c_str,
bool  take = true 
)

Definition at line 361 of file MLGOParser.cpp.

References TokenStream::peek(), TokenStream::take(), and Text.

Referenced by comparator_type(), conditional_op(), data_type(), expect_text(), gemm_type(), gpu_behavior(), gpu_priority(), heuristic_tree(), heuristic_type(), heuristics_table(), ip_type(), and mlgo().

362 {
363  auto tok = in.peek();
364  if(tok.type == TokenType::Text && tok.value == c_str)
365  {
366  if(take)
367  {
368  in.take();
369  }
370  return true;
371  }
372  return false;
373 }

◆ advance()

void arm_compute::mlgo::parser::advance ( CharPosition pos,
char  ch 
)

Definition at line 147 of file MLGOParser.cpp.

References CharPosition::col, and CharPosition::ln.

Referenced by rewind().

148 {
149  if(ch == '\n')
150  {
151  pos.ln += 1;
152  pos.col = 0;
153  }
154  else
155  {
156  pos.col += 1;
157  }
158 }

◆ bool_val()

bool arm_compute::mlgo::parser::bool_val ( TokenStream in,
bool &  valid 
)

Definition at line 300 of file MLGOParser.cpp.

References FAIL_WITH_MSG_DEFAULT, Int, LOG_TOKEN_POS, and TokenStream::take().

Referenced by gemm_config_reshaped(), and gemm_config_reshaped_only_rhs().

301 {
302  LOG_TOKEN_POS(in, pos);
303  auto tok = in.take();
304  if(tok.type != TokenType::Int)
305  {
306  FAIL_WITH_MSG_DEFAULT(valid, false, pos, "Expect bool or int token");
307  }
308  bool val{};
309  std::stringstream(tok.value) >> val;
310  return val;
311 }
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG_DEFAULT(valid_var, default_val, pos, msg)
Definition: MLGOParser.cpp:65

◆ comparator_type()

ComparatorType arm_compute::mlgo::parser::comparator_type ( TokenStream in,
bool &  valid 
)

Definition at line 510 of file MLGOParser.cpp.

References accept_text(), Enum, FAIL_WITH_MSG_DEFAULT, LOG_TOKEN_POS, Num, and Var.

Referenced by condition().

511 {
512  LOG_TOKEN_POS(in, pos);
513  if(accept_text(in, "var"))
514  {
515  return ComparatorType::Var;
516  }
517  else if(accept_text(in, "num"))
518  {
519  return ComparatorType::Num;
520  }
521  else if(accept_text(in, "enum"))
522  {
523  return ComparatorType::Enum;
524  }
525  else
526  {
527  FAIL_WITH_MSG_DEFAULT(valid, ComparatorType::Num, pos, "Expect comparator type");
528  }
529 }
bool accept_text(TokenStream &in, const std::string &c_str, bool take=true)
Definition: MLGOParser.cpp:361
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG_DEFAULT(valid_var, default_val, pos, msg)
Definition: MLGOParser.cpp:65

◆ condition()

Condition arm_compute::mlgo::parser::condition ( TokenStream in,
bool &  valid 
)

Definition at line 697 of file MLGOParser.cpp.

References CHECK_DEFAULT, comparator_type(), conditional_op(), FAIL_WITH_MSG_DEFAULT, float_val(), LOG_TOKEN_POS, Num, text_val(), and Var.

Referenced by HeuristicTree::BranchNode::BranchNode(), and heuristic_tree().

698 {
699  LOG_TOKEN_POS(in, pos);
700  // NOTE: Only simplified Conditions are accepted, which means the lhs comparator type is fixed to Var and that of
701  // the rhs is fixed to Num (float)
702  const auto invalid_val = Condition{};
703  const auto l_t = CHECK_DEFAULT(comparator_type(in, valid), valid, invalid_val);
704  const auto l_v = CHECK_DEFAULT(text_val(in, valid), valid, invalid_val);
705  const auto c_o = CHECK_DEFAULT(conditional_op(in, valid), valid, invalid_val);
706  const auto r_t = CHECK_DEFAULT(comparator_type(in, valid), valid, invalid_val);
707  const auto r_v = CHECK_DEFAULT(float_val(in, valid), valid, invalid_val);
708  if(l_t != ComparatorType::Var || r_t != ComparatorType::Num)
709  {
710  FAIL_WITH_MSG_DEFAULT(valid, invalid_val, pos, "Only accept LHS type to be Var (string) and RHS type to be Num (float)");
711  }
712  return Condition{ l_v, c_o, r_v };
713 }
std::string text_val(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:350
ComparatorType comparator_type(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:510
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define CHECK_DEFAULT(parser_expr, valid_var, default_val)
Definition: MLGOParser.cpp:35
float float_val(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:337
ConditionalOp conditional_op(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:424
#define FAIL_WITH_MSG_DEFAULT(valid_var, default_val, pos, msg)
Definition: MLGOParser.cpp:65

◆ conditional_op()

ConditionalOp arm_compute::mlgo::parser::conditional_op ( TokenStream in,
bool &  valid 
)

Definition at line 424 of file MLGOParser.cpp.

References accept_text(), arm_compute::mlgo::EQ, FAIL_WITH_MSG_DEFAULT, arm_compute::mlgo::GE, arm_compute::mlgo::GT, arm_compute::mlgo::LE, LOG_TOKEN_POS, and arm_compute::mlgo::LT.

Referenced by condition().

425 {
426  LOG_TOKEN_POS(in, pos);
427  if(accept_text(in, "<="))
428  {
429  return ConditionalOp::LE;
430  }
431  else if(accept_text(in, ">="))
432  {
433  return ConditionalOp::GE;
434  }
435  else if(accept_text(in, "=="))
436  {
437  return ConditionalOp::EQ;
438  }
439  else if(accept_text(in, "<"))
440  {
441  return ConditionalOp::LT;
442  }
443  else if(accept_text(in, ">"))
444  {
445  return ConditionalOp::GT;
446  }
447  else
448  {
449  FAIL_WITH_MSG_DEFAULT(valid, ConditionalOp::EQ, pos, "Expect conditional op");
450  }
451 }
bool accept_text(TokenStream &in, const std::string &c_str, bool take=true)
Definition: MLGOParser.cpp:361
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG_DEFAULT(valid_var, default_val, pos, msg)
Definition: MLGOParser.cpp:65

◆ data_type()

DataType arm_compute::mlgo::parser::data_type ( TokenStream in,
bool &  valid 
)

Definition at line 489 of file MLGOParser.cpp.

References accept_text(), arm_compute::F16, arm_compute::F32, FAIL_WITH_MSG_DEFAULT, LOG_TOKEN_POS, and arm_compute::QASYMM8.

Referenced by heuristics_table_entry().

490 {
491  LOG_TOKEN_POS(in, pos);
492  if(accept_text(in, "f16"))
493  {
494  return DataType::F16;
495  }
496  else if(accept_text(in, "f32"))
497  {
498  return DataType::F32;
499  }
500  else if(accept_text(in, "qasymm8"))
501  {
502  return DataType::QASYMM8;
503  }
504  else
505  {
506  FAIL_WITH_MSG_DEFAULT(valid, DataType::QASYMM8, pos, "Expect data type");
507  }
508 }
bool accept_text(TokenStream &in, const std::string &c_str, bool take=true)
Definition: MLGOParser.cpp:361
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG_DEFAULT(valid_var, default_val, pos, msg)
Definition: MLGOParser.cpp:65

◆ end()

void arm_compute::mlgo::parser::end ( TokenStream in,
bool &  valid 
)

Definition at line 290 of file MLGOParser.cpp.

References End, FAIL_WITH_MSG, LOG_TOKEN_POS, and TokenStream::take().

Referenced by ValidationOutputAccessor::access_tensor(), CLTuner::add_tuning_params(), ISimpleLifetimeManager::are_all_finalized(), CpuInfo::build(), arm_compute::graph::detail::call_all_input_node_accessors(), arm_compute::graph::detail::call_all_output_node_accessors(), Window::collapse_if_possible(), arm_compute::helpers::tensor_transform::compute_strided_slice_output_shape(), AccessWindowTranspose::compute_valid_region(), AccessWindowRectangle::compute_valid_region(), NERangeKernel::configure(), CLRangeKernel::configure(), CLCrop::configure(), ClWinogradConv2d::configure(), StackLayerNode::configure_output(), ConcatenateLayerNode::configure_output(), arm_compute::create_window_iterator(), arm_compute::test::validation::DATA_TEST_CASE(), DATA_TEST_CASE(), arm_compute::helpers::fft::digit_reverse_indices(), ISimpleLifetimeManager::end_lifetime(), arm_compute::enqueue(), arm_compute::error_on_invalid_subwindow(), arm_compute::error_on_mismatching_windows(), arm_compute::error_on_window_dimensions_gte(), arm_compute::error_on_window_not_collapsable_at_dimension(), GemvPretransposed< strategy, To, Tr, OutputStage >::execute(), GemmInterleaved< strategy, To, Tr, OutputStage, MergeStep, ForceThreadColumns >::execute(), GraphManager::execute_graph(), NPYLoader::fill_tensor(), GraphManager::finalize_graph(), Framework::init(), GraphContext::insert_memory_management_ctx(), GraphContext::insert_weights_management_ctx(), GraphManager::invalidate_graph(), TestFilter::is_selected(), arm_compute::test::framework::dataset::make(), OffsetLifetimeManager::mapping_type(), BlobLifetimeManager::mapping_type(), OpenCLClock< output_timestamps >::measurements(), GraphContext::memory_management_ctx(), mlgo(), InPlaceOperationMutator::mutate(), NERangeKernel::name(), arm_compute::cpuinfo::num_threads_hint(), NEGEMM::prepare(), CLGEMM::prepare(), NEGEMMLowpMatrixMultiplyCore::prepare(), NEGEMMConv2d::prepare(), CLGEMMConvolutionLayer::prepare(), Framework::print_test_info(), RangeDataset< T >::RangeDataset(), arm_compute::read_file(), CPPDetectionOutputLayer::run(), CPPNonMaximumSuppressionKernel::run(), Framework::run(), ClWinogradInputTransformKernel::run_op(), Window::shape(), Window::split_window(), ISimpleLifetimeManager::start_lifetime(), SchedulerClock< output_timestamps >::test_start(), SchedulerClock< output_timestamps >::test_stop(), arm_gemm::to_ndcoord(), arm_gemm::to_ndrange(), arm_compute::test::tolower(), arm_compute::utility::tolower(), TopNPredictionsAccessor::TopNPredictionsAccessor(), PoolManager::unlock_pool(), AccessWindowTranspose::update_window_if_needed(), AccessWindowRectangle::update_window_if_needed(), Window::validate(), ValidationInputAccessor::ValidationInputAccessor(), ValidationOutputAccessor::ValidationOutputAccessor(), GraphContext::weights_management_ctx(), and MaliCounter::~MaliCounter().

291 {
292  LOG_TOKEN_POS(in, pos);
293  auto tok = in.take();
294  if(tok.type != TokenType::End)
295  {
296  FAIL_WITH_MSG(valid, pos, "Unexpected token at the end of stream");
297  }
298 }
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG(valid_var, pos, msg)
Definition: MLGOParser.cpp:61

◆ expect_heuristic_type()

void arm_compute::mlgo::parser::expect_heuristic_type ( TokenStream in,
HeuristicType  expected_ht,
bool &  valid 
)

Definition at line 556 of file MLGOParser.cpp.

References CHECK, FAIL_WITH_MSG, heuristic_type(), and LOG_TOKEN_POS.

Referenced by heuristic_tree().

557 {
558  LOG_TOKEN_POS(in, pos);
559  auto ht = CHECK(heuristic_type(in, valid, false), valid);
560  if(ht != expected_ht)
561  {
562  FAIL_WITH_MSG(valid, pos, "Unexpected heuristic type");
563  }
564  CHECK(heuristic_type(in, valid, true), valid);
565 }
#define CHECK(parser_expr, valid_var)
Definition: MLGOParser.cpp:30
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
HeuristicType heuristic_type(TokenStream &in, bool &valid, bool take=true)
Definition: MLGOParser.cpp:531
#define FAIL_WITH_MSG(valid_var, pos, msg)
Definition: MLGOParser.cpp:61

◆ expect_l_list()

void arm_compute::mlgo::parser::expect_l_list ( TokenStream in,
bool &  valid 
)

Definition at line 395 of file MLGOParser.cpp.

References accept_l_list(), FAIL_WITH_MSG, and LOG_TOKEN_POS.

Referenced by free_vars(), gemm_config_native(), gemm_config_reshaped(), gemm_config_reshaped_only_rhs(), and gemm_version().

396 {
397  LOG_TOKEN_POS(in, pos);
398  if(!accept_l_list(in))
399  {
400  FAIL_WITH_MSG(valid, pos, "Expect '['");
401  }
402 }
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG(valid_var, pos, msg)
Definition: MLGOParser.cpp:61
bool accept_l_list(TokenStream &in)
Definition: MLGOParser.cpp:384

◆ expect_r_list()

void arm_compute::mlgo::parser::expect_r_list ( TokenStream in,
bool &  valid 
)

Definition at line 415 of file MLGOParser.cpp.

References accept_r_list(), FAIL_WITH_MSG, and LOG_TOKEN_POS.

Referenced by gemm_config_native(), gemm_config_reshaped(), gemm_config_reshaped_only_rhs(), and gemm_version().

416 {
417  LOG_TOKEN_POS(in, pos);
418  if(!accept_r_list(in))
419  {
420  FAIL_WITH_MSG(valid, pos, "Expect ']'");
421  }
422 }
bool accept_r_list(TokenStream &in)
Definition: MLGOParser.cpp:404
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG(valid_var, pos, msg)
Definition: MLGOParser.cpp:61

◆ expect_text()

void arm_compute::mlgo::parser::expect_text ( TokenStream in,
const std::string &  str,
bool &  valid 
)

Definition at line 375 of file MLGOParser.cpp.

References accept_text(), FAIL_WITH_MSG, and LOG_TOKEN_POS.

Referenced by gemm_version(), header(), heuristic_tree(), heuristics_table(), and ip_type().

376 {
377  LOG_TOKEN_POS(in, pos);
378  if(!accept_text(in, str))
379  {
380  FAIL_WITH_MSG(valid, pos, std::string("Expect text token: ") + str);
381  }
382 }
bool accept_text(TokenStream &in, const std::string &c_str, bool take=true)
Definition: MLGOParser.cpp:361
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG(valid_var, pos, msg)
Definition: MLGOParser.cpp:61

◆ float_val()

float arm_compute::mlgo::parser::float_val ( TokenStream in,
bool &  valid 
)

Definition at line 337 of file MLGOParser.cpp.

References FAIL_WITH_MSG_DEFAULT, Float, LOG_TOKEN_POS, and TokenStream::take().

Referenced by condition().

338 {
339  LOG_TOKEN_POS(in, pos);
340  auto tok = in.take();
341  if(tok.type != TokenType::Float)
342  {
343  FAIL_WITH_MSG_DEFAULT(valid, 0.f, pos, "Expect float token");
344  }
345  float val{};
346  std::stringstream(tok.value) >> val;
347  return val;
348 }
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG_DEFAULT(valid_var, default_val, pos, msg)
Definition: MLGOParser.cpp:65

◆ free_vars()

void arm_compute::mlgo::parser::free_vars ( TokenStream in,
bool &  valid 
)

Definition at line 665 of file MLGOParser.cpp.

References accept_r_list(), CHECK, expect_l_list(), and text_val().

Referenced by heuristics_table_entry().

666 {
667  CHECK(expect_l_list(in, valid), valid);
668  while(!accept_r_list(in))
669  {
670  CHECK(text_val(in, valid), valid);
671  }
672 }
std::string text_val(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:350
#define CHECK(parser_expr, valid_var)
Definition: MLGOParser.cpp:30
bool accept_r_list(TokenStream &in)
Definition: MLGOParser.cpp:404
void expect_l_list(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:395

◆ gemm_config_native()

GEMMConfigNative arm_compute::mlgo::parser::gemm_config_native ( TokenStream in,
bool &  valid 
)

Definition at line 588 of file MLGOParser.cpp.

References CHECK_DEFAULT, expect_l_list(), expect_r_list(), and uint_val().

Referenced by heuristic_tree().

589 {
590  const auto invalid_val = GEMMConfigNative{};
591  CHECK_DEFAULT(expect_l_list(in, valid), valid, invalid_val);
592  const auto m0 = CHECK_DEFAULT(uint_val(in, valid), valid, invalid_val);
593  const auto n0 = CHECK_DEFAULT(uint_val(in, valid), valid, invalid_val);
594  const auto k0 = CHECK_DEFAULT(uint_val(in, valid), valid, invalid_val);
595  CHECK_DEFAULT(expect_r_list(in, valid), valid, invalid_val);
596  return GEMMConfigNative{ m0, n0, k0 };
597 }
#define CHECK_DEFAULT(parser_expr, valid_var, default_val)
Definition: MLGOParser.cpp:35
void expect_r_list(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:415
void expect_l_list(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:395
unsigned int uint_val(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:326

◆ gemm_config_reshaped()

GEMMConfigReshaped arm_compute::mlgo::parser::gemm_config_reshaped ( TokenStream in,
bool &  valid 
)

Definition at line 614 of file MLGOParser.cpp.

References bool_val(), CHECK_DEFAULT, expect_l_list(), expect_r_list(), and uint_val().

Referenced by heuristic_tree().

615 {
616  const auto invalid_val = GEMMConfigReshaped{};
617  CHECK_DEFAULT(expect_l_list(in, valid), valid, invalid_val);
618  const auto m0 = CHECK_DEFAULT(uint_val(in, valid), valid, invalid_val);
619  const auto n0 = CHECK_DEFAULT(uint_val(in, valid), valid, invalid_val);
620  const auto k0 = CHECK_DEFAULT(uint_val(in, valid), valid, invalid_val);
621  const auto v0 = CHECK_DEFAULT(uint_val(in, valid), valid, invalid_val);
622  const auto h0 = CHECK_DEFAULT(uint_val(in, valid), valid, invalid_val);
623  const auto il = CHECK_DEFAULT(bool_val(in, valid), valid, invalid_val);
624  const auto ir = CHECK_DEFAULT(bool_val(in, valid), valid, invalid_val);
625  const auto tr = CHECK_DEFAULT(bool_val(in, valid), valid, invalid_val);
626  const auto ex = CHECK_DEFAULT(bool_val(in, valid), valid, invalid_val);
627  CHECK_DEFAULT(expect_r_list(in, valid), valid, invalid_val);
628  return GEMMConfigReshaped{ m0, n0, k0, v0, h0, il, ir, tr, ex };
629 }
#define CHECK_DEFAULT(parser_expr, valid_var, default_val)
Definition: MLGOParser.cpp:35
void expect_r_list(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:415
bool bool_val(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:300
void expect_l_list(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:395
unsigned int uint_val(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:326

◆ gemm_config_reshaped_only_rhs()

GEMMConfigReshapedOnlyRHS arm_compute::mlgo::parser::gemm_config_reshaped_only_rhs ( TokenStream in,
bool &  valid 
)

Definition at line 599 of file MLGOParser.cpp.

References bool_val(), CHECK_DEFAULT, expect_l_list(), expect_r_list(), and uint_val().

Referenced by heuristic_tree().

600 {
601  const auto invalid_val = GEMMConfigReshapedOnlyRHS{};
602  CHECK_DEFAULT(expect_l_list(in, valid), valid, invalid_val);
603  const auto m0 = CHECK_DEFAULT(uint_val(in, valid), valid, invalid_val);
604  const auto n0 = CHECK_DEFAULT(uint_val(in, valid), valid, invalid_val);
605  const auto k0 = CHECK_DEFAULT(uint_val(in, valid), valid, invalid_val);
606  const auto h0 = CHECK_DEFAULT(uint_val(in, valid), valid, invalid_val);
607  const auto ir = CHECK_DEFAULT(bool_val(in, valid), valid, invalid_val);
608  const auto tr = CHECK_DEFAULT(bool_val(in, valid), valid, invalid_val);
609  const auto ex = CHECK_DEFAULT(bool_val(in, valid), valid, invalid_val);
610  CHECK_DEFAULT(expect_r_list(in, valid), valid, invalid_val);
611  return GEMMConfigReshapedOnlyRHS{ m0, n0, k0, h0, ir, tr, ex };
612 }
#define CHECK_DEFAULT(parser_expr, valid_var, default_val)
Definition: MLGOParser.cpp:35
void expect_r_list(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:415
bool bool_val(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:300
void expect_l_list(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:395
unsigned int uint_val(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:326

◆ gemm_type()

GEMMType arm_compute::mlgo::parser::gemm_type ( TokenStream in,
bool &  valid 
)

Definition at line 567 of file MLGOParser.cpp.

References accept_text(), FAIL_WITH_MSG_DEFAULT, LOG_TOKEN_POS, arm_compute::NATIVE, arm_compute::RESHAPED, and arm_compute::RESHAPED_ONLY_RHS.

Referenced by GEMMTypeResult::GEMMTypeResult(), heuristic_tree(), CLGEMMDefaultTypeBifrost::select_kernel(), and arm_compute::cl_gemm::auto_heuristics::select_mlgo_gemm_kernel().

568 {
569  LOG_TOKEN_POS(in, pos);
570  if(accept_text(in, "native"))
571  {
572  return GEMMType::NATIVE;
573  }
574  else if(accept_text(in, "reshaped-only-rhs"))
575  {
576  return GEMMType::RESHAPED_ONLY_RHS;
577  }
578  else if(accept_text(in, "reshaped"))
579  {
580  return GEMMType::RESHAPED;
581  }
582  else
583  {
584  FAIL_WITH_MSG_DEFAULT(valid, GEMMType::RESHAPED_ONLY_RHS, pos, "Expect gemm type");
585  }
586 }
bool accept_text(TokenStream &in, const std::string &c_str, bool take=true)
Definition: MLGOParser.cpp:361
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG_DEFAULT(valid_var, default_val, pos, msg)
Definition: MLGOParser.cpp:65

◆ gemm_version()

void arm_compute::mlgo::parser::gemm_version ( TokenStream in,
bool &  valid 
)

Definition at line 453 of file MLGOParser.cpp.

References CHECK, expect_l_list(), expect_r_list(), expect_text(), and uint_val().

Referenced by header().

454 {
455  CHECK(expect_text(in, "gemm-version", valid), valid);
456  CHECK(expect_l_list(in, valid), valid);
457  CHECK(uint_val(in, valid), valid);
458  CHECK(uint_val(in, valid), valid);
459  CHECK(uint_val(in, valid), valid);
460  CHECK(expect_r_list(in, valid), valid);
461 }
#define CHECK(parser_expr, valid_var)
Definition: MLGOParser.cpp:30
void expect_text(TokenStream &in, const std::string &str, bool &valid)
Definition: MLGOParser.cpp:375
void expect_r_list(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:415
void expect_l_list(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:395
unsigned int uint_val(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:326

◆ gpu_behavior()

void arm_compute::mlgo::parser::gpu_behavior ( TokenStream in,
bool &  valid 
)

Definition at line 648 of file MLGOParser.cpp.

References accept_text(), FAIL_WITH_MSG, and LOG_TOKEN_POS.

Referenced by heuristics_table_entry().

649 {
650  LOG_TOKEN_POS(in, pos);
651  if(accept_text(in, "static"))
652  {
653  ;
654  }
655  else if(accept_text(in, "dynamic"))
656  {
657  ;
658  }
659  else
660  {
661  FAIL_WITH_MSG(valid, pos, "Expect ip type");
662  }
663 }
bool accept_text(TokenStream &in, const std::string &c_str, bool take=true)
Definition: MLGOParser.cpp:361
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG(valid_var, pos, msg)
Definition: MLGOParser.cpp:61

◆ gpu_priority()

void arm_compute::mlgo::parser::gpu_priority ( TokenStream in,
bool &  valid 
)

Definition at line 631 of file MLGOParser.cpp.

References accept_text(), FAIL_WITH_MSG, and LOG_TOKEN_POS.

Referenced by heuristics_table_entry().

632 {
633  LOG_TOKEN_POS(in, pos);
634  if(accept_text(in, "best-performance"))
635  {
636  ;
637  }
638  else if(accept_text(in, "best-memory-usage"))
639  {
640  ;
641  }
642  else
643  {
644  FAIL_WITH_MSG(valid, pos, "Expect gpu priority");
645  }
646 }
bool accept_text(TokenStream &in, const std::string &c_str, bool take=true)
Definition: MLGOParser.cpp:361
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG(valid_var, pos, msg)
Definition: MLGOParser.cpp:61

◆ header()

void arm_compute::mlgo::parser::header ( TokenStream in,
bool &  valid 
)

Definition at line 481 of file MLGOParser.cpp.

References CHECK, expect_text(), gemm_version(), and ip_type().

Referenced by mlgo(), arm_compute::utils::parse_npy_header(), and arm_compute::test::detail::validate_npy_header().

482 {
483  CHECK(expect_text(in, "<header>", valid), valid);
484  CHECK(gemm_version(in, valid), valid);
485  CHECK(ip_type(in, valid), valid);
486  CHECK(expect_text(in, "</header>", valid), valid);
487 }
#define CHECK(parser_expr, valid_var)
Definition: MLGOParser.cpp:30
void expect_text(TokenStream &in, const std::string &str, bool &valid)
Definition: MLGOParser.cpp:375
void gemm_version(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:453
void ip_type(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:463

◆ heuristic_tree()

void arm_compute::mlgo::parser::heuristic_tree ( TokenStream in,
MLGOHeuristics h,
bool &  valid 
)

Definition at line 715 of file MLGOParser.cpp.

References accept_text(), HeuristicTree::add_branch(), HeuristicTree::add_leaf(), CHECK, MLGOHeuristics::check_heuristic_tree(), condition(), expect_heuristic_type(), expect_text(), FAIL_WITH_MSG, arm_compute::mlgo::GEMM_Config_Native, gemm_config_native(), arm_compute::mlgo::GEMM_Config_Reshaped, gemm_config_reshaped(), arm_compute::mlgo::GEMM_Config_Reshaped_Only_RHS, gemm_config_reshaped_only_rhs(), arm_compute::mlgo::GEMM_Type, gemm_type(), MLGOHeuristics::get_heuristic_tree(), HeuristicTree::index(), LOG_TOKEN_POS, tf_frozen_model_extractor::t, and uint_val().

Referenced by mlgo().

716 {
717  CHECK(expect_text(in, "<heuristic", valid), valid);
718  const auto tree_id = CHECK(uint_val(in, valid), valid);
719  CHECK(expect_text(in, ">", valid), valid);
720  HeuristicTree *t = nullptr;
721  std::tie(valid, t) = CHECK(h.get_heuristic_tree(tree_id), valid);
722  const HeuristicType t_heuristic_type = std::get<0>(t->index());
723  while(!accept_text(in, "</heuristic>"))
724  {
725  LOG_TOKEN_POS(in, pos);
726  if(accept_text(in, "b"))
727  {
728  // Branch node
729  const auto id = CHECK(uint_val(in, valid), valid);
730  const auto cond = CHECK(condition(in, valid), valid);
731  const auto t_id = CHECK(uint_val(in, valid), valid);
732  const auto f_id = CHECK(uint_val(in, valid), valid);
733  valid = CHECK(t->add_branch(id, cond, t_id, f_id), valid);
734  }
735  else if(accept_text(in, "l"))
736  {
737  // Leaf node
738  const auto id = CHECK(uint_val(in, valid), valid);
739  // NOTE: Heuristic type within each tree appears to be redundant (same information can be obtained from the
740  // heuristic table). For now it remains as a step for validation.
741  LOG_TOKEN_POS(in, pos);
742  CHECK(expect_heuristic_type(in, t_heuristic_type, valid), valid);
743  switch(t_heuristic_type)
744  {
745  case HeuristicType::GEMM_Type:
746  {
747  const auto g_type = CHECK(gemm_type(in, valid), valid);
748  valid = CHECK(t->add_leaf(id, g_type), valid);
749  break;
750  }
751  case HeuristicType::GEMM_Config_Native:
752  {
753  const auto g_c = CHECK(gemm_config_native(in, valid), valid);
754  valid = CHECK(t->add_leaf(id, g_c), valid);
755  break;
756  }
757  case HeuristicType::GEMM_Config_Reshaped_Only_RHS:
758  {
759  const auto g_c = CHECK(gemm_config_reshaped_only_rhs(in, valid), valid);
760  valid = CHECK(t->add_leaf(id, g_c), valid);
761  break;
762  }
763  case HeuristicType::GEMM_Config_Reshaped:
764  {
765  const auto g_c = CHECK(gemm_config_reshaped(in, valid), valid);
766  valid = CHECK(t->add_leaf(id, g_c), valid);
767  break;
768  }
769  default:
770  {
771  FAIL_WITH_MSG(valid, pos, "Unexpected heuristic type");
772  }
773  }
774  }
775  else
776  {
777  FAIL_WITH_MSG(valid, pos, "Expect tree node type");
778  }
779  }
780  // Perform semantic checks in the middle of parsing so that it can fail fast should there be any invalidities
781  valid = CHECK(h.check_heuristic_tree(tree_id), valid);
782 }
#define CHECK(parser_expr, valid_var)
Definition: MLGOParser.cpp:30
void expect_text(TokenStream &in, const std::string &str, bool &valid)
Definition: MLGOParser.cpp:375
GEMMConfigNative gemm_config_native(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:588
Condition condition(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:697
bool accept_text(TokenStream &in, const std::string &c_str, bool take=true)
Definition: MLGOParser.cpp:361
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
void expect_heuristic_type(TokenStream &in, HeuristicType expected_ht, bool &valid)
Definition: MLGOParser.cpp:556
GEMMType gemm_type(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:567
HeuristicType
Types of Heuristic (tree)
Definition: Common.h:35
GEMMConfigReshaped gemm_config_reshaped(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:614
#define FAIL_WITH_MSG(valid_var, pos, msg)
Definition: MLGOParser.cpp:61
GEMMConfigReshapedOnlyRHS gemm_config_reshaped_only_rhs(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:599
unsigned int uint_val(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:326

◆ heuristic_type()

HeuristicType arm_compute::mlgo::parser::heuristic_type ( TokenStream in,
bool &  valid,
bool  take = true 
)

Definition at line 531 of file MLGOParser.cpp.

References accept_text(), FAIL_WITH_MSG_DEFAULT, arm_compute::mlgo::GEMM_Config_Native, arm_compute::mlgo::GEMM_Config_Reshaped, arm_compute::mlgo::GEMM_Config_Reshaped_Only_RHS, arm_compute::mlgo::GEMM_Type, LOG_TOKEN_POS, and TokenStream::take().

Referenced by expect_heuristic_type(), and heuristics_table_entry().

532 {
533  LOG_TOKEN_POS(in, pos);
534  if(accept_text(in, "gemm-type", take))
535  {
536  return HeuristicType::GEMM_Type;
537  }
538  else if(accept_text(in, "gemm-config-native", take))
539  {
540  return HeuristicType::GEMM_Config_Native;
541  }
542  else if(accept_text(in, "gemm-config-reshaped-only-rhs", take))
543  {
544  return HeuristicType::GEMM_Config_Reshaped_Only_RHS;
545  }
546  else if(accept_text(in, "gemm-config-reshaped", take))
547  {
548  return HeuristicType::GEMM_Config_Reshaped;
549  }
550  else
551  {
552  FAIL_WITH_MSG_DEFAULT(valid, HeuristicType::GEMM_Config_Reshaped, pos, "Expect heuristic type");
553  }
554 }
bool accept_text(TokenStream &in, const std::string &c_str, bool take=true)
Definition: MLGOParser.cpp:361
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG_DEFAULT(valid_var, default_val, pos, msg)
Definition: MLGOParser.cpp:65

◆ heuristics_table()

void arm_compute::mlgo::parser::heuristics_table ( TokenStream in,
MLGOHeuristics h,
bool &  valid 
)

Definition at line 688 of file MLGOParser.cpp.

References accept_text(), CHECK, expect_text(), and heuristics_table_entry().

Referenced by mlgo().

689 {
690  CHECK(expect_text(in, "<heuristics-table>", valid), valid);
691  while(!accept_text(in, "</heuristics-table>"))
692  {
693  CHECK(heuristics_table_entry(in, h, valid), valid);
694  }
695 }
#define CHECK(parser_expr, valid_var)
Definition: MLGOParser.cpp:30
void expect_text(TokenStream &in, const std::string &str, bool &valid)
Definition: MLGOParser.cpp:375
bool accept_text(TokenStream &in, const std::string &c_str, bool take=true)
Definition: MLGOParser.cpp:361
void heuristics_table_entry(TokenStream &in, MLGOHeuristics &h, bool &valid)
Definition: MLGOParser.cpp:674

◆ heuristics_table_entry()

void arm_compute::mlgo::parser::heuristics_table_entry ( TokenStream in,
MLGOHeuristics h,
bool &  valid 
)

Definition at line 674 of file MLGOParser.cpp.

References MLGOHeuristics::add_heuristic_tree(), CHECK, data_type(), dt, free_vars(), gpu_behavior(), gpu_priority(), heuristic_type(), tf_frozen_model_extractor::t, text_val(), and uint_val().

Referenced by heuristics_table().

675 {
676  const auto id = CHECK(uint_val(in, valid), valid);
677  const auto ip = CHECK(text_val(in, valid), valid);
678  CHECK(uint_val(in, valid), valid); // Num cores
679  const auto dt = CHECK(data_type(in, valid), valid);
680  CHECK(gpu_priority(in, valid), valid);
681  CHECK(gpu_behavior(in, valid), valid);
682  const auto ht = CHECK(heuristic_type(in, valid), valid);
683  CHECK(free_vars(in, valid), valid);
684  HeuristicTree t(id, ht, ip, dt);
685  valid = CHECK(h.add_heuristic_tree(std::move(t)), valid);
686 }
std::string text_val(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:350
#define CHECK(parser_expr, valid_var)
Definition: MLGOParser.cpp:30
void free_vars(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:665
DataType dt
DataType data_type(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:489
void gpu_priority(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:631
void gpu_behavior(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:648
HeuristicType heuristic_type(TokenStream &in, bool &valid, bool take=true)
Definition: MLGOParser.cpp:531
unsigned int uint_val(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:326

◆ int_val()

int arm_compute::mlgo::parser::int_val ( TokenStream in,
bool &  valid 
)

Definition at line 313 of file MLGOParser.cpp.

References FAIL_WITH_MSG_DEFAULT, Int, LOG_TOKEN_POS, and TokenStream::take().

Referenced by uint_val().

314 {
315  LOG_TOKEN_POS(in, pos);
316  auto tok = in.take();
317  if(tok.type != TokenType::Int)
318  {
319  FAIL_WITH_MSG_DEFAULT(valid, -1, pos, "Expect int token");
320  }
321  int val{};
322  std::stringstream(tok.value) >> val;
323  return val;
324 }
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG_DEFAULT(valid_var, default_val, pos, msg)
Definition: MLGOParser.cpp:65

◆ ip_type()

void arm_compute::mlgo::parser::ip_type ( TokenStream in,
bool &  valid 
)

Definition at line 463 of file MLGOParser.cpp.

References accept_text(), CHECK, expect_text(), FAIL_WITH_MSG, and LOG_TOKEN_POS.

Referenced by header().

464 {
465  CHECK(expect_text(in, "ip-type", valid), valid);
466  LOG_TOKEN_POS(in, pos);
467  if(accept_text(in, "gpu"))
468  {
469  ;
470  }
471  else if(accept_text(in, "cpu"))
472  {
473  ;
474  }
475  else
476  {
477  FAIL_WITH_MSG(valid, pos, "Expect ip type");
478  }
479 }
#define CHECK(parser_expr, valid_var)
Definition: MLGOParser.cpp:30
void expect_text(TokenStream &in, const std::string &str, bool &valid)
Definition: MLGOParser.cpp:375
bool accept_text(TokenStream &in, const std::string &c_str, bool take=true)
Definition: MLGOParser.cpp:361
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG(valid_var, pos, msg)
Definition: MLGOParser.cpp:61

◆ mlgo()

MLGOHeuristics arm_compute::mlgo::parser::mlgo ( TokenStream in,
bool &  valid 
)

Definition at line 784 of file MLGOParser.cpp.

References accept_text(), MLGOHeuristics::check_all(), CHECK_DEFAULT, end(), header(), heuristic_tree(), and heuristics_table().

Referenced by parse_mlgo().

785 {
786  MLGOHeuristics h;
787  CHECK_DEFAULT(header(in, valid), valid, h);
788  CHECK_DEFAULT(heuristics_table(in, h, valid), valid, h);
789  while(accept_text(in, "<heuristic", false))
790  {
791  CHECK_DEFAULT(heuristic_tree(in, h, valid), valid, h);
792  }
793  CHECK_DEFAULT(end(in, valid), valid, h);
794  valid = CHECK_DEFAULT(h.check_all(), valid, h);
795  return h;
796 }
bool accept_text(TokenStream &in, const std::string &c_str, bool take=true)
Definition: MLGOParser.cpp:361
void heuristic_tree(TokenStream &in, MLGOHeuristics &h, bool &valid)
Definition: MLGOParser.cpp:715
void heuristics_table(TokenStream &in, MLGOHeuristics &h, bool &valid)
Definition: MLGOParser.cpp:688
#define CHECK_DEFAULT(parser_expr, valid_var, default_val)
Definition: MLGOParser.cpp:35
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290
void header(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:481

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const CharPosition pos 
)

Definition at line 178 of file Utils.cpp.

References CharPosition::col, and CharPosition::ln.

179 {
180  os << "(Ln: " << pos.ln << ", Col: " << pos.col << ")";
181  return os;
182 }

◆ parse_mlgo()

std::pair< bool, MLGOHeuristics > parse_mlgo ( std::istream &  in)

Parse and construct a MLGOHeuristics from input stream.

Parameters
[in]inInput stream
Returns
MLGOHeuristics

Definition at line 798 of file MLGOParser.cpp.

References mlgo(), and TokenStream::TokenStream().

Referenced by TokenStream::current_pos(), and MLGOHeuristics::reload_from_stream().

799 {
800  auto tokens = TokenStream(in);
801  bool valid = true;
802  auto h = mlgo(tokens, valid);
803  return std::make_pair(std::move(valid), std::move(h));
804 }
MLGOHeuristics mlgo(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:784

◆ rewind()

void arm_compute::mlgo::parser::rewind ( CharPosition pos)

Definition at line 159 of file MLGOParser.cpp.

References advance(), CharPosition::col, End, Float, Int, L_List, R_List, and Text.

160 {
161  pos.col -= 1;
162 }

◆ text_val()

std::string arm_compute::mlgo::parser::text_val ( TokenStream in,
bool &  valid 
)

Definition at line 350 of file MLGOParser.cpp.

References FAIL_WITH_MSG_DEFAULT, LOG_TOKEN_POS, TokenStream::take(), and Text.

Referenced by condition(), free_vars(), and heuristics_table_entry().

351 {
352  LOG_TOKEN_POS(in, pos);
353  auto tok = in.take();
354  if(tok.type != TokenType::Text || tok.value.empty())
355  {
356  FAIL_WITH_MSG_DEFAULT(valid, "", pos, "Expect a non-empty text token");
357  }
358  return tok.value;
359 }
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define FAIL_WITH_MSG_DEFAULT(valid_var, default_val, pos, msg)
Definition: MLGOParser.cpp:65

◆ uint_val()

unsigned int arm_compute::mlgo::parser::uint_val ( TokenStream in,
bool &  valid 
)

Definition at line 326 of file MLGOParser.cpp.

References CHECK_DEFAULT, FAIL_WITH_MSG_DEFAULT, int_val(), and LOG_TOKEN_POS.

Referenced by gemm_config_native(), gemm_config_reshaped(), gemm_config_reshaped_only_rhs(), gemm_version(), heuristic_tree(), and heuristics_table_entry().

327 {
328  LOG_TOKEN_POS(in, pos);
329  int val = CHECK_DEFAULT(int_val(in, valid), valid, 0);
330  if(val < 0)
331  {
332  FAIL_WITH_MSG_DEFAULT(valid, 0, pos, "Expect unsigned int token");
333  }
334  return static_cast<unsigned int>(val);
335 }
#define LOG_TOKEN_POS(tokens, pos_var)
Definition: MLGOParser.cpp:69
#define CHECK_DEFAULT(parser_expr, valid_var, default_val)
Definition: MLGOParser.cpp:35
#define FAIL_WITH_MSG_DEFAULT(valid_var, default_val, pos, msg)
Definition: MLGOParser.cpp:65
int int_val(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:313