[FRONTEND] Fix libdevice (#776)
Fix two problems in libdevice and external dispatch: 1. Use static triton types (e.g., tl.int32) instead of creating new types. Otherwise, `tl.int32` and `tl.dtype('int32')` are not the same thing. 2. The name of an extern inst should be empty but not the symbol name of the inst. TTIR generator will assign names automatically. Otherwise, we have the same variable name when there are multiple same extern insts. Before the PR: ```bash __nv_exp = extern_elementwise f64<1024> %11; __nv_exp = extern_elementwise f64<1024> %11; ``` After the PR: ```bash %12 = extern_elementwise f64<1024> %11; %13 = extern_elementwise f64<1024> %11; ```
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -51,9 +51,9 @@ def convert_type(type_str):
|
||||
elif type_str == "u64":
|
||||
return "uint64"
|
||||
elif type_str == "float":
|
||||
return "fp32"
|
||||
return "float32"
|
||||
elif type_str == "double":
|
||||
return "fp64"
|
||||
return "float64"
|
||||
else:
|
||||
# ignore other types, such as pointer types
|
||||
return None
|
||||
@@ -268,8 +268,8 @@ class Libdevice(ExternLibrary):
|
||||
for symbol in symbols:
|
||||
arg_type_symbol_dict_str += "("
|
||||
for arg_type in symbol.arg_types:
|
||||
arg_type_symbol_dict_str += f"core.dtype(\"{arg_type}\"),"
|
||||
ret_type = f"core.dtype(\"{symbol.ret_type}\")"
|
||||
arg_type_symbol_dict_str += f"core.{arg_type},"
|
||||
ret_type = f"core.{symbol.ret_type}"
|
||||
arg_type_symbol_dict_str += "): (\"" + symbol.name + "\", " + ret_type + "),\n"
|
||||
arg_type_symbol_dict_str += "}"
|
||||
|
||||
|
Reference in New Issue
Block a user