Merge branch 'master' into v2.0

This commit is contained in:
Philippe Tillet
2022-01-30 20:25:01 -08:00
committed by GitHub
3 changed files with 3 additions and 59 deletions

View File

@@ -472,6 +472,7 @@ class CodeGenerator(ast.NodeVisitor):
def visit_Str(self, node):
return triton.language.constexpr(ast.literal_eval(node))
def visit_Attribute(self, node):
lhs = self.visit(node.value)
return getattr(lhs, node.attr)

View File

@@ -38,8 +38,8 @@ def add_kernel(
offsets = block_start + tl.arange(0, BLOCK_SIZE)
# Create a mask to guard memory operations against out-of-bounds accesses
mask = offsets < n_elements
# Load x and y from DRAM, masking out any extra elements in case
# the input is not a multiple of the block size
# Load x and y from DRAM, masking out any extra elements in case the input is not a
# multiple of the block size
x = tl.load(x_ptr + offsets, mask=mask)
y = tl.load(y_ptr + offsets, mask=mask)
output = x + y