[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:
@@ -1119,7 +1119,8 @@ class extern_elementwise_inst : public instruction {
|
||||
extern_elementwise_inst(context &ctx, const std::vector<value *> &args,
|
||||
type *dst_ty, const std::string &lib_name,
|
||||
const std::string &extern_lib_path,
|
||||
const std::string &symbol_name, instruction *next);
|
||||
const std::string &symbol_name,
|
||||
const std::string &name, instruction *next);
|
||||
std::string repr_impl() const { return "extern_elementwise"; }
|
||||
_TRITON_DEFINE_CLONE(extern_elementwise_inst)
|
||||
_TRITON_DEFINE_ACCEPT(extern_elementwise_inst)
|
||||
@@ -1128,14 +1129,17 @@ class extern_elementwise_inst : public instruction {
|
||||
static extern_elementwise_inst *create(
|
||||
context &ctx, const std::vector<value *> &args, type *dst_ty,
|
||||
const std::string &lib_name = "", const std::string &lib_path = "",
|
||||
const std::string &symbol_name = "", instruction *next = nullptr);
|
||||
const std::string &symbol_name = "", const std::string &name = "",
|
||||
instruction *next = nullptr);
|
||||
|
||||
const std::string &get_lib_name() const { return lib_name_; }
|
||||
const std::string &get_lib_path() const { return lib_path_; }
|
||||
const std::string &get_symbol_name() const { return symbol_name_; }
|
||||
|
||||
private:
|
||||
std::string lib_name_ = "";
|
||||
std::string lib_path_ = "";
|
||||
std::string lib_name_;
|
||||
std::string lib_path_;
|
||||
std::string symbol_name_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user