llvm / llvm/offload-test-suite

[Metal] Abort in patchIsSpecialFloat for vectorized isnan or isinf

Open
#1,494 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
18
Forks
39
Avg merge
2d 18h
Merged PRs (30d)
40

Description

We are seeing the failure on two tests:
> OffloadTest-mtl :: Feature/HLSLLib/long-vector/isinf.long-vector.32.test
> OffloadTest-mtl :: Feature/HLSLLib/long-vector/isnan.long-vector.32.test

This seems to be specific to DXC and not clang-dxc which makes me think `patchIsSpecialFloat` can't handle longer vectors.
For clang-dxc it is likely not erroring because we scalarize.

https://feedbackassistant.apple.com/feedback/24450254

It looks like patchIsSpecialFloat might not have the ability to handle vector floats. I am not on the latest version of metal-shaderconverter.

metal-shaderconverter --version
metal-irconverter version: 3.0.0

```gdb
# | metal-shaderconverter: [patchIsSpecialFloat:7420] Fatal: patchIsSpecialFloat argument was not a valid floating point type
# | Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
# | 0 offloader 0x0000000104a39208 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
# | 1 offloader 0x0000000104a36f50 llvm::sys::RunSignalHandlers() + 204
# | 2 offloader 0x0000000104a39d08 SignalHandler(int, __siginfo*, void*) + 320
# | 3 libsystem_platform.dylib 0x000000018a843744 _sigtramp + 56
# | 4 libsystem_pthread.dylib 0x000000018a839888 pthread_kill + 296
# | 5 libsystem_c.dylib 0x000000018a73e850 abort + 124
# | 6 libmetalirconverter.dylib 0x0000000108ec0ff0 AIRBuilder::patchIsSpecialFloat(llvm::MDNode*, llvm::Instruction&, std::__1::basic_string, std::__1::allocator>&) + 1172
# | 7 offloader 0x0000000104a73c7c (anonymous namespace)::MTLDevice::createPipelineCs(llvm::StringRef, offloadtest::BindingsDesc const&, offloadtest::ShaderContainer) + 212
# | 8 offloader 0x0000000104a732c4 (anonymous namespace)::MTLDevice::executeProgram(offloadtest::Pipeline&) + 3868
# | 9 offloader 0x00000001049dc998 main + 2072
# | 10 dyld 0x000000018a471d54 start + 7184
# `-----------------------------
# error: command failed with exit status: -6
```

## Example cases:

```hlsl
StructuredBuffer In0 : register(t0);
RWStructuredBuffer Out : register(u1);

[numthreads(1,1,1)]
void main() {
vector Input0_5;
for (uint I = 0; I < 5; ++I)
Input0_5[I] = In0[0 + I];
vector Result5 = isnan(Input0_5);
for (uint I = 0; I < 5; ++I)
Out[0 + I] = Result5[I];
}
```

```hlsl
StructuredBuffer In0 : register(t0);
RWStructuredBuffer Out : register(u1);

[numthreads(1,1,1)]
void main() {
vector Input0_5;
for (uint I = 0; I < 5; ++I)
Input0_5[I] = In0[0 + I];
vector Result5 = isinf(Input0_5);
for (uint I = 0; I < 5; ++I)
Out[0 + I] = Result5[I];
}
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failing OffloadTest-mtl long-vector/isinf.long-vector.32.test and isnan.long-vector.32.test cases, then inspect the patchIsSpecialFloat entry point named in the stack trace. Reproduce the abort with the provided HLSL examples and compare DXC with clang-dxc. Done means both vectorized tests complete without the invalid floating-point type abort.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.