llvm / llvm/offload-test-suite

[Metal] `sin.32` and `cos.32` tests failing on Macs due to improper handling of NaN, Inf, denorm floats

Open
#701 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The tests `Feature/HLSLLib/cos.32.test` and `Feature/HLSLLib/sin.32.test` are failing on some Apple devices due to improper handling of NaN, Inf, and denorm floats. This happens with and without the `-Gis` compiler flag.

Update: as found while making PR #702, splitting off the NaN, Inf, and denorm into their own test allowed Machine 3 to pass with DXC.

Thus far, we have only the following information to go off of:

Machine 1 - Pass
```
SoC: Apple M1
ProductName: macOS
ProductVersion: TBD
BuildVersion: TBD
metal-irconverter version: TBD
Default triple: TBD
```

Machine 2 - Pass
```
SoC: Apple M2
ProductName: macOS
ProductVersion: TBD
BuildVersion: TBD
metal-irconverter version: TBD
Default triple: TBD
```

Machine 3 - Fail
```
SoC: Apple M3 Max
ProductName: macOS
ProductVersion: 15.6.1
BuildVersion: 24G90
metal-irconverter version: 3.0.5
Default triple: air64-apple-macosx15.0.0
```

Machine 4 - Fail
```
SoC: Apple M4 Pro
ProductName: macOS
ProductVersion: 26.2
BuildVersion: 25C56
metal-irconverter version: 3.0.6
Default triple: air64-apple-macosx15.0.0
```

Logs from Machine 3 (Apple M4 Pro)
- DXC: https://github.com/llvm/offload-test-suite/actions/runs/21608308376/job/62270556528
- Clang: https://github.com/llvm/offload-test-suite/actions/runs/21610376388/job/62277521345

```
FAIL: OffloadTest-mtl :: Feature/HLSLLib/cos.32.test (95 of 333)
******************** TEST 'OffloadTest-mtl :: Feature/HLSLLib/cos.32.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Using Metal API
Created compute commands.

--
Command Output (stderr):
--
/Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/bin/split-file /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/OffloadTest/test/Feature/HLSLLib/cos.32.test /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/cos.32.test.tmp # RUN: at line 67
+ /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/bin/split-file /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/OffloadTest/test/Feature/HLSLLib/cos.32.test /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/cos.32.test.tmp
"/Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/DXC/build/bin/dxc-3.7" -metal -T cs_6_5 -Fo /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/cos.32.test.tmp.o /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/cos.32.test.tmp/source.hlsl # RUN: at line 68
+ /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/DXC/build/bin/dxc-3.7 -metal -T cs_6_5 -Fo /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/cos.32.test.tmp.o /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/cos.32.test.tmp/source.hlsl
/Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/bin/offloader -debug-layer /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/cos.32.test.tmp/pipeline.yaml /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/cos.32.test.tmp.o # RUN: at line 69
+ /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/bin/offloader -debug-layer /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/cos.32.test.tmp/pipeline.yaml /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/cos.32.test.tmp.o
2026-02-02 14:12:24.612 offloader[6949:12977065] *** -[NSAutoreleasePool addObject:]: Do not use this instance method on specific pools -- just use -autorelease instead.
Test failed: Test1
Comparison Rule: BufferFloatEpsilon
Epsilon: 0.0008
Expected:
---
Name: ExpectedOut
Format: Float32
Stride: 16
Data: [ nan, nan, 1, 1, 1, 1, nan, 1, 1, nan, nan, nan ]
OutputProps:
Height: 0
Width: 0
Depth: 0
...
Got:
---
Name: Out
Format: Float32
Stride: 16
Data: [ 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0 ]
OutputProps:
Height: 0
Width: 0
Depth: 0
...
Full Hex 64bit representation of Expected Buffer Values:
[ nan, nan, 0x1p+0, 0x1p+0, 0x1p+0, 0x1p+0, nan, 0x1.fffff6p-1, 0x1.fffff6p-1, nan, nan, nan ]
Full Hex 64bit representation of Actual Buffer Values:
[ 0x0p+0, 0x0p+0, 0x1p+0, 0x1p+0, 0x1p+0, 0x1p+0, 0x0p+0, 0x1.fffff4p-1, 0x1.fffff4p-1, 0x0p+0, 0x0p+0, 0x0p+0 ]

--

********************
...
FAIL: OffloadTest-mtl :: Feature/HLSLLib/sin.32.test (195 of 333)
******************** TEST 'OffloadTest-mtl :: Feature/HLSLLib/sin.32.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Using Metal API
Created compute commands.

--
Command Output (stderr):
--
/Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/bin/split-file /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/OffloadTest/test/Feature/HLSLLib/sin.32.test /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/sin.32.test.tmp # RUN: at line 67
+ /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/bin/split-file /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/OffloadTest/test/Feature/HLSLLib/sin.32.test /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/sin.32.test.tmp
"/Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/DXC/build/bin/dxc-3.7" -metal -T cs_6_5 -Fo /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/sin.32.test.tmp.o /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/sin.32.test.tmp/source.hlsl # RUN: at line 68
+ /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/DXC/build/bin/dxc-3.7 -metal -T cs_6_5 -Fo /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/sin.32.test.tmp.o /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/sin.32.test.tmp/source.hlsl
/Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/bin/offloader -debug-layer /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/sin.32.test.tmp/pipeline.yaml /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/sin.32.test.tmp.o # RUN: at line 69
+ /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/bin/offloader -debug-layer /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/sin.32.test.tmp/pipeline.yaml /Users/admin/actions-runner/_work/offload-test-suite/offload-test-suite/llvm-project/build/tools/OffloadTest/test/mtl/Feature/HLSLLib/Output/sin.32.test.tmp.o
2026-02-02 14:12:25.710 offloader[7387:12978540] *** -[NSAutoreleasePool addObject:]: Do not use this instance method on specific pools -- just use -autorelease instead.
Test failed: Test1
Comparison Rule: BufferFloatEpsilon
Epsilon: 0.0008
Expected:
---
Name: ExpectedOut
Format: Float32
Stride: 16
Data: [ nan, nan, -0, -0, 0, 0, nan, -0.00073464, 0.00073464,
nan, nan, nan ]
OutputProps:
Height: 0
Width: 0
Depth: 0
...
Got:
---
Name: Out
Format: Float32
Stride: 16
Data: [ 0, 0, -1.12e-38, -0, 0, 1.12e-38, 0, -0.000738303, 0.000738303,
0, 0, 0 ]
OutputProps:
Height: 0
Width: 0
Depth: 0
...
Full Hex 64bit representation of Expected Buffer Values:
[ nan, nan, -0x0p+0, -0x0p+0, 0x0p+0, 0x0p+0, nan, -0x1.8129bap-11, 0x1.8129bap-11, nan, nan, nan ]
Full Hex 64bit representation of Actual Buffer Values:
[ 0x0p+0, 0x0p+0, -0x1.e7d42cp-127, -0x0p+0, 0x0p+0, 0x1.e7d42cp-127, 0x0p+0, -0x1.83155ap-11, 0x1.83155ap-11, 0x0p+0, 0x0p+0, 0x0p+0 ]

--

********************
```

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 Feature/HLSLLib/cos.32.test and Feature/HLSLLib/sin.32.test, then reproduce the Metal failures using the DXC and offloader commands shown in the logs. Compare NaN, Inf, and denorm results on the affected Apple devices; done means the relevant cases pass consistently, including when separated as described in the update.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos
Domain
compilers, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.