[LANG] Added log intrinsic

This commit is contained in:
Philippe Tillet
2020-11-03 15:50:11 -05:00
committed by Philippe Tillet
parent 02a6e81b88
commit f152150e7d
16 changed files with 74 additions and 14 deletions

View File

@@ -18,8 +18,6 @@ namespace rt = triton::runtime;
typedef std::pair<int, int> map_key_t;
std::map<map_key_t, std::shared_ptr<rt::function::grid_fn_ty>> id_grid_map;
std::map<map_key_t, std::shared_ptr<rt::function>> id_fn_map;
std::map<size_t, double> fp64scalar_map;
std::map<size_t, int64_t> i64scalar_map;
/* Grid utilities */
@@ -45,6 +43,7 @@ void delete_fn(const map_key_t& key) {
id_fn_map.erase(key);
}
void register_cst(const map_key_t& key, const std::string& name, pybind11::buffer& data) {
pybind11::buffer_info info = data.request();
id_fn_map[key]->set_cst(name, info.ptr, info.size*info.itemsize);
@@ -53,7 +52,6 @@ void register_cst(const map_key_t& key, const std::string& name, pybind11::buffe
void cleanup() {
id_grid_map.clear();
id_fn_map.clear();
i64scalar_map.clear();
}
size_t make_op_id() {

View File

@@ -81,8 +81,9 @@ class kernel:
raise RuntimeError('Must provide grid for kernel launch')
grid = kwargs['grid']
libtriton.register_grid((self.op_id, device), grid)
# re-allocate buffers for auto-tuning
if 'autotune_buf' in kwargs:
pass
# launch
#print(self.tys)
params = pack(self.tys, *[x.data_ptr() if isinstance(x, torch.Tensor) else x for x in args])
torch.cuda.synchronize()
torch.ops.triton.launch_kernel(self.op_id, device, params)