From b5dcac484dee177d9dd6c4e600713750cb03768c Mon Sep 17 00:00:00 2001 From: Philippe Tillet Date: Thu, 20 May 2021 01:12:30 -0400 Subject: [PATCH] [CODEGEN] Small bugfix in atomic-add (#114) --- lib/codegen/selection/generator.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/codegen/selection/generator.cc b/lib/codegen/selection/generator.cc index 630ae855f..63f72f9ff 100644 --- a/lib/codegen/selection/generator.cc +++ b/lib/codegen/selection/generator.cc @@ -902,7 +902,7 @@ void generator::visit_atomic_add_inst(ir::atomic_add_inst* add) { // asm string std::string suffix = vec == 2 ? "x2" : ""; std::string mod = nbits == 32 ? "" : ".noftz"; - std::string ty_str = ty->isFloatingPointTy() ? "f" : "u"; + std::string ty_str = add->get_type()->get_scalar_ty()->is_floating_point_ty() ? "f" : "u"; std::string asm_str = "@$0 atom.global.gpu.add" + mod + "." + ty_str + std::to_string(nbits) + suffix + " $1, [$2" + offset + "], $3;"; std::string ty_id = nbits == 32 ? ty_str : (vec == 1 ? "h" : "r"); std::string constraint = "b,=" + ty_id + ",l," + ty_id; @@ -921,7 +921,7 @@ void generator::visit_atomic_add_inst(ir::atomic_add_inst* add) { std::vector arg_ty = {rmw_msk->getType(), rmw_ptr->getType(), rmw_val->getType()}; FunctionType *fn_ty = FunctionType::get(ty, arg_ty, false); std::string mod = nbits == 32 ? "" : ".noftz"; - std::string ty_str = ty->isFloatingPointTy() ? "f" : "u"; + std::string ty_str = add->get_type()->get_scalar_ty()->is_floating_point_ty() ? "f" : "u"; std::string asm_str = "@$0 atom.global.gpu.add" + mod + "." + ty_str + std::to_string(nbits) + " $1, [$2], $3;"; std::string ty_id = nbits == 32 ? "r" : "h"; InlineAsm *iasm = InlineAsm::get(fn_ty, asm_str, "b,="+ty_id+",l,"+ty_id, true);