[llvm] [nvptx] Fix autoupdater's intrinsic matcher (PR #73330)

Nathan Sidwell via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 24 06:18:19 PST 2023


https://github.com/urnathan created https://github.com/llvm/llvm-project/pull/73330

The nvptx autoupdater's intrinsic matcher has some suspicious-looking strings.  These use '_' (underbar) as the separator, rather than '.' (dot) like all the others.  The 'fma.rn.ftz_bf16' string particularly so, as it's paired with 'fma.rn.ftz.bf16x2'. These strings were like this from the original commit (250f2bb2c6a9c) in 2023-06-23 by kahmadian at nvidia.com.  AFAICT looking at the rest of that diff, there's nothing special about the 5 intrinsics affected, and the TD files do not seem to be making any effort to use '_' rather than '.' on them.

There is no change in test coverage -- these intrinsics do not appear to be tested?

>From 246a2c78d44836f2cc604ed1f7d6a4b816f21341 Mon Sep 17 00:00:00 2001
From: Nathan Sidwell <nathan at acm.org>
Date: Fri, 24 Nov 2023 09:07:47 -0500
Subject: [PATCH] [nvptx] Fix autoupdater's intrinsic matcher

The nvptx autoupdater's intrinsic matcher has some suspicious-looking
strings.  These use '_' (underbar) as the separator, rather than '.'
(dot) like all the others.  The 'fma.rn.ftz_bf16' string particularly
so, as it's paired with 'fma.rn.ftz.bf16x2'. These strings were like
this from the original commit (250f2bb2c6a9c) in 2023-06-23 by
kahmadian at nvidia.com.  AFAICT looking at the rest of that diff,
there's nothing special about the 5 intrinsics affected, and the TD
files do not seem to be making any effort to use '_' rather than '.'
on them.

There is no change in test coverage -- these intrinsics do not appear
to be tested?
---
 llvm/lib/IR/AutoUpgrade.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 63c4b2c71299900..6d55544c0af0dd5 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -635,12 +635,12 @@ static Intrinsic::ID ShouldUpgradeNVPTXBF16Intrinsic(StringRef Name) {
     return StringSwitch<Intrinsic::ID>(Name)
         .Case("bf16", Intrinsic::nvvm_fma_rn_bf16)
         .Case("bf16x2", Intrinsic::nvvm_fma_rn_bf16x2)
-        .Case("ftz_bf16", Intrinsic::nvvm_fma_rn_ftz_bf16)
+        .Case("ftz.bf16", Intrinsic::nvvm_fma_rn_ftz_bf16)
         .Case("ftz.bf16x2", Intrinsic::nvvm_fma_rn_ftz_bf16x2)
         .Case("ftz.relu.bf16", Intrinsic::nvvm_fma_rn_ftz_relu_bf16)
         .Case("ftz.relu.bf16x2", Intrinsic::nvvm_fma_rn_ftz_relu_bf16x2)
-        .Case("ftz_sat.bf16", Intrinsic::nvvm_fma_rn_ftz_sat_bf16)
-        .Case("ftz_sat.bf16x2", Intrinsic::nvvm_fma_rn_ftz_sat_bf16x2)
+        .Case("ftz.sat.bf16", Intrinsic::nvvm_fma_rn_ftz_sat_bf16)
+        .Case("ftz.sat.bf16x2", Intrinsic::nvvm_fma_rn_ftz_sat_bf16x2)
         .Case("relu.bf16", Intrinsic::nvvm_fma_rn_relu_bf16)
         .Case("relu.bf16x2", Intrinsic::nvvm_fma_rn_relu_bf16x2)
         .Case("sat.bf16", Intrinsic::nvvm_fma_rn_sat_bf16)
@@ -677,8 +677,8 @@ static Intrinsic::ID ShouldUpgradeNVPTXBF16Intrinsic(StringRef Name) {
         .Case("bf16x2", Intrinsic::nvvm_fmin_bf16x2)
         .Case("ftz.bf16", Intrinsic::nvvm_fmin_ftz_bf16)
         .Case("ftz.bf16x2", Intrinsic::nvvm_fmin_ftz_bf16x2)
-        .Case("ftz.nan_bf16", Intrinsic::nvvm_fmin_ftz_nan_bf16)
-        .Case("ftz.nan_bf16x2", Intrinsic::nvvm_fmin_ftz_nan_bf16x2)
+        .Case("ftz.nan.bf16", Intrinsic::nvvm_fmin_ftz_nan_bf16)
+        .Case("ftz.nan.bf16x2", Intrinsic::nvvm_fmin_ftz_nan_bf16x2)
         .Case("ftz.nan.xorsign.abs.bf16",
               Intrinsic::nvvm_fmin_ftz_nan_xorsign_abs_bf16)
         .Case("ftz.nan.xorsign.abs.bf16x2",



More information about the llvm-commits mailing list