def visit_ScalarAccess(self, node: oir.ScalarAccess, *, symtable: Dict[str, Any], **kwargs: Any) -> cuir.ScalarAccess: if isinstance(symtable.get(node.name, None), oir.ScalarDecl): return cuir.FieldAccess(name=node.name, offset=common.CartesianOffset.zero(), dtype=node.dtype) return cuir.ScalarAccess(name=node.name, dtype=node.dtype)
def _make_axis_offset_expr(bound: common.AxisBound, axis_index: int) -> cuir.Expr: if bound.level == common.LevelMarker.END: base = cuir.ScalarAccess(name="{}_size".format(["i", "j"][axis_index]), dtype=common.DataType.INT32) return cuir.BinaryOp( op=common.ArithmeticOperator.ADD, left=base, right=cuir.Literal(value=str(bound.offset), dtype=common.DataType.INT32), ) else: return cuir.Literal(value=str(bound.offset), dtype=common.DataType.INT32)