Skip to content

Commit

Permalink
Address review feedback - 5
Browse files Browse the repository at this point in the history
  • Loading branch information
giuseros committed Sep 26, 2024
1 parent 5ad49bf commit 563ea29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions python/triton/backends/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ def __init__(self, params=None, values=None):
self.property_values = {}
self.constant_properties = set()

self.add_common_properties(params, values)
self.add_additional_properties(params, values)
self.init_slots()
self._add_common_properties(params, values)
self._add_backend_properties(params, values)
self._init_slots()

def add_common_properties(self, params, values):
def _add_common_properties(self, params, values):
""" Add common compile-time properties """
self.property_values["tt.divisibility"] = 16
self.property_values["tt.equal_to_1"] = 1
Expand All @@ -83,11 +83,11 @@ def add_common_properties(self, params, values):
if AttrsDescriptor.is_equal_to_1(arg) and not param.do_not_specialize
]

def add_additional_properties(self, params=None, values=None):
def _add_backend_properties(self, params=None, values=None):
""" This method is for different subclasses to implement their own compile-time properties """
pass

def init_slots(self):
def _init_slots(self):
""" Initialize the slots of this class """
for name, val in self.arg_properties.items():
setattr(self, name.removeprefix('tt.'), val)
Expand Down Expand Up @@ -142,7 +142,7 @@ def from_dict(data):
attrsDescriptor = AttrsDescriptor()
for prop_name, param_ids in data.items():
attrsDescriptor.arg_properties[prop_name] = param_ids
attrsDescriptor.init_slots()
attrsDescriptor._init_slots()
return attrsDescriptor

@staticmethod
Expand All @@ -159,7 +159,7 @@ def from_hints(hints: list[tuple[int, int]]):
attrsDescriptor = AttrsDescriptor()
for prop_name, prop_val in attrsDescriptor.property_values.items():
attrsDescriptor.arg_properties[prop_name] = [i for i, h in hints.items() if h == prop_val]
attrsDescriptor.init_slots()
attrsDescriptor._init_slots()
return attrsDescriptor

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion python/triton/tools/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def constexpr(s):
arg_types.append(signature[arg_name])
arg_names_not_1.append(arg_name)
arg_types_not_1.append(signature[arg_name])
elif i in attrs["tt.equal_to_1"]:
elif i in attrs.equal_to_1:
arg_names.append(arg_name)
arg_types.append(signature[arg_name])

Expand Down

0 comments on commit 563ea29

Please sign in to comment.