[llvm] [DirectX][NFC] Model precise overload type specification of DXIL Ops (PR #83917)

S. Bharadwaj Yadavalli via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 13:27:30 PDT 2024


================
@@ -219,6 +269,20 @@ static std::string getOverloadKindStr(MVT::SimpleValueType VT) {
     return "OverloadKind::I16 | OverloadKind::I32 | OverloadKind::I64";
   case MVT::fAny:
     return "OverloadKind::HALF | OverloadKind::FLOAT | OverloadKind::DOUBLE";
+  case MVT::Other:
+    // Handle DXIL-specific overload types
+    {
+      auto RetStr =
+          StringSwitch<std::string>(R->getNameInitAsString())
+              .Case("llvm_i16ori32_ty", "OverloadKind::I16 | OverloadKind::I32")
+              .Case("llvm_halforfloat_ty",
+                    "OverloadKind::HALF | OverloadKind::FLOAT")
----------------
bharadwajy wrote:

> Hm, I'm not sure that really worked out that well. We're still switching over the names in "getParameterKind" so we haven't really improved the abstraction, and the if chain over the known set of bools is probably just as error prone.

I missed changing this usage. I pushed a change. Thanks!

> Are these the only two instances of these sets of types that are needed for all of the DXIL ops? 

No. It appears that there are other instances of valid overload types of some DXIL Ops that would be over-specified using LLVM's `*Any` value type. For example, valid overload types of [`WaveMatrix_Fill`](https://github.com/microsoft/DirectXShaderCompiler/blob/130877392c263888ef06bab768856d3dab1f1c9a/utils/hct/hctdb.py#L5036) are `half`, `float` and `int`. However, I have not yet formulated how (if?) such DXIL ops should be specified in `DXIL.td`. 

> If there are others, are they always two types or could it be a larger set?

Such overload types can include more than two fixed types.  

https://github.com/llvm/llvm-project/pull/83917


More information about the llvm-commits mailing list