[llvm] [NVPTX] Fix crash caused by ComputePTXValueVTs (PR #104524)

Justin Fargnoli via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 18:10:10 PDT 2024


================
@@ -0,0 +1,61 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s
+
+target triple = "nvptx-nvidia-cuda"
+
+define <6 x half> @half6() {
----------------
justinfargnoli wrote:

I used the below script to write the tests. Let me know if I misunderstood the ask,

```
#!/usr/bin/python3

import math

MAX_BYTES = 24
MAX_ELEMENT_COUNT = 200

pairs = []

for data_size in [1, 8, 16, 32, 64]:
    for element_count in range(1, MAX_ELEMENT_COUNT):
        if element_count!= 1 and math.log2(element_count).is_integer():
            continue
        if element_count * data_size > MAX_BYTES * 8:
            continue

        pairs.append((data_size, element_count))

pairs.reverse()
        
for data_size, element_count in pairs:
    if data_size == 1:
        data_name = "bit"
    elif data_size == 8:
        data_name = "byte"
    elif data_size == 16:
        data_name = "short"
    elif data_size == 32:
        data_name = "int"
    elif data_size == 64:
        data_name = "long"
    else:
        assert(False)
    
    print(f"define <{element_count} x i{data_size}> @{data_name}{element_count}()" " {\n" f"\tret <{element_count} x i{data_size}> zeroinitializer\n" "}\n")
```

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


More information about the llvm-commits mailing list