llvm / llvm/offload-test-suite

[Intel][Vulkan][Clang] Elementwise bitcasts are producing a cast to a zero-initialized type on Intel

Open
#599 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Issue

These don't crash like https://github.com/llvm/llvm-project/issues/170534 does but they are also returning outputs of all zero.
There seems to be something wrong with the spv bitcast.

@s-perron mentioned this pr: https://github.com/llvm/llvm-project/pull/169696 will handle many element-wise matrix operations. maybe that will also include elementwise bitcast. For now the plan is to xfail the tests in the offload test suite.

Trunc cast SPIRV failure Example 1

******************** TEST 'OffloadTest-clang-vk :: Basic/Matrix/matrix_trunc_cast.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 59
e:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\split-file.exe E:\actions-runner\_work\offload-test-suite\offload-test-suite\OffloadTest\test\Basic\Matrix\matrix_trunc_cast.test E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_trunc_cast.test.tmp
# executed command: 'e:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\split-file.exe' 'E:\actions-runner\_work\offload-test-suite\offload-test-suite\OffloadTest\test\Basic\Matrix\matrix_trunc_cast.test' 'E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_trunc_cast.test.tmp'
# RUN: at line 60
e:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\clang-dxc.exe -spirv -fspv-target-env=vulkan1.3 -fspv-extension=DXC --dxv-path=E:/actions-runner/_work/offload-test-suite/offload-test-suite/DXC/build/bin -T cs_6_0 -Fo E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_trunc_cast.test.tmp.o E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_trunc_cast.test.tmp/source.hlsl
# executed command: 'e:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\clang-dxc.exe' -spirv -fspv-target-env=vulkan1.3 -fspv-extension=DXC --dxv-path=E:/actions-runner/_work/offload-test-suite/offload-test-suite/DXC/build/bin -T cs_6_0 -Fo 'E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_trunc_cast.test.tmp.o' 'E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_trunc_cast.test.tmp/source.hlsl'
# RUN: at line 61
e:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\offloader.exe -debug-layer E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_trunc_cast.test.tmp/pipeline.yaml E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_trunc_cast.test.tmp.o
# executed command: 'e:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\offloader.exe' -debug-layer 'E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_trunc_cast.test.tmp/pipeline.yaml' 'E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_trunc_cast.test.tmp.o'
# .---command stdout------------
# | Using Vulkan API
# | Physical device created.
# | Shader module created.
# | Copy command buffer created.
# | Memory buffers created.
# | Executed copy command buffer.
# | Execute command buffer created.
# | Descriptors: { type = 5, count = 2 }
# | Descriptor pool created.
# | Binding 2 descriptors.
# | Num Descriptor sets: 1
# | Updating Descriptor [0] { 0, 0 }
# | Updating Descriptor [1] { 0, 1 }
# | WriteDescriptors: 2
# | Descriptor sets created.
# | Compute pipeline created.
# | Dispatched compute shader: { 1, 1, 1 }
# | Commands created.
# | Executed compute command buffer.
# | Compute pipeline created.
# | Cleanup complete.
# `-----------------------------
# .---command stderr------------
# | Test failed: Out
# | Comparison Rule: BufferExact
# | Expected:
# | ---
# | Name:            ExpectedOut
# | Format:          Int32
# | Data:            [ 1, 2, 5, 6 ]
# | OutputProps:
# |   Height:          0
# |   Width:           0
# |   Depth:           0
# | ...
# | Got:
# | ---
# | Name:            Out
# | Format:          Int32
# | Data:            [ 0, 0, 0, 0 ]
# | OutputProps:
# |   Height:          0
# |   Width:           0
# |   Depth:           0
# | ...
# | Full Hex 64bit representation of Expected Buffer Values:
# | [ 0x1, 0x2, 0x5, 0x6 ]
# | Full Hex 64bit representation of Actual Buffer Values:
# | [ 0x0, 0x0, 0x0, 0x0 ]
# | 
# `-----------------------------
# error: command failed with exit status: 1

--

vector elementwise cast SPIRV failure Example 2

********************
FAIL: OffloadTest-clang-vk :: Basic/Matrix/matrix_elementwise_vector_cast.test (25 of 297)
******************** TEST 'OffloadTest-clang-vk :: Basic/Matrix/matrix_elementwise_vector_cast.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 76
e:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\split-file.exe E:\actions-runner\_work\offload-test-suite\offload-test-suite\OffloadTest\test\Basic\Matrix\matrix_elementwise_vector_cast.test E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_elementwise_vector_cast.test.tmp
# executed command: 'e:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\split-file.exe' 'E:\actions-runner\_work\offload-test-suite\offload-test-suite\OffloadTest\test\Basic\Matrix\matrix_elementwise_vector_cast.test' 'E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_elementwise_vector_cast.test.tmp'
# RUN: at line 77
e:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\clang-dxc.exe -spirv -fspv-target-env=vulkan1.3 -fspv-extension=DXC --dxv-path=E:/actions-runner/_work/offload-test-suite/offload-test-suite/DXC/build/bin -T cs_6_0 -Fo E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_elementwise_vector_cast.test.tmp.o E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_elementwise_vector_cast.test.tmp/source.hlsl
# executed command: 'e:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\clang-dxc.exe' -spirv -fspv-target-env=vulkan1.3 -fspv-extension=DXC --dxv-path=E:/actions-runner/_work/offload-test-suite/offload-test-suite/DXC/build/bin -T cs_6_0 -Fo 'E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_elementwise_vector_cast.test.tmp.o' 'E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_elementwise_vector_cast.test.tmp/source.hlsl'
# RUN: at line 78
e:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\offloader.exe -debug-layer E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_elementwise_vector_cast.test.tmp/pipeline.yaml E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_elementwise_vector_cast.test.tmp.o
# executed command: 'e:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\offloader.exe' -debug-layer 'E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_elementwise_vector_cast.test.tmp/pipeline.yaml' 'E:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-vk\Basic\Matrix\Output\matrix_elementwise_vector_cast.test.tmp.o'
# .---command stdout------------
# | Using Vulkan API
# | Physical device created.
# | Shader module created.
# | Copy command buffer created.
# | Memory buffers created.
# | Executed copy command buffer.
# | Execute command buffer created.
# | Descriptors: { type = 5, count = 3 }
# | Descriptor pool created.
# | Binding 3 descriptors.
# | Num Descriptor sets: 1
# | Updating Descriptor [0] { 0, 0 }
# | Updating Descriptor [1] { 0, 1 }
# | Updating Descriptor [2] { 0, 2 }
# | WriteDescriptors: 3
# | Descriptor sets created.
# | Compute pipeline created.
# | Dispatched compute shader: { 1, 1, 1 }
# | Commands created.
# | Executed compute command buffer.
# | Compute pipeline created.
# | Cleanup complete.
# `-----------------------------
# .---command stderr------------
# | Test failed: FloatMatOut
# | Comparison Rule: BufferExact
# | Expected:
# | ---
# | Name:            ExpectedFloatOut
# | Format:          Float32
# | Data:            [ 1.1, 2.2, 3.3, 4.4 ]
# | OutputProps:
# |   Height:          0
# |   Width:           0
# |   Depth:           0
# | ...
# | Got:
# | ---
# | Name:            FloatMatOut
# | Format:          Float32
# | Data:            [ 0, 0, 0, 0 ]
# | OutputProps:
# |   Height:          0
# |   Width:           0
# |   Depth:           0
# | ...
# | Full Hex 64bit representation of Expected Buffer Values:
# | [ 0x1.1, 0x2.2, 0x3.3, 0x4.4 ]
# | Full Hex 64bit representation of Actual Buffer Values:
# | [ 0x0, 0x0, 0x0, 0x0 ]
# | 
# | Test failed: IntMatOut
# | Comparison Rule: BufferExact
# | Expected:
# | ---
# | Name:            ExpectedIntOut
# | Format:          Int32
# | Data:            [ 1, 2, 3, 4 ]
# | OutputProps:
# |   Height:          0
# |   Width:           0
# |   Depth:           0
# | ...
# | Got:
# | ---
# | Name:            IntMatOut
# | Format:          Int32
# | Data:            [ 0, 0, 0, 0 ]
# | OutputProps:
# |   Height:          0
# |   Width:           0
# |   Depth:           0
# | ...
# | Full Hex 64bit representation of Expected Buffer Values:
# | [ 0x1, 0x2, 0x3, 0x4 ]
# | Full Hex 64bit representation of Actual Buffer Values:
# | [ 0x0, 0x0, 0x0, 0x0 ]
# | 
# `-----------------------------
# error: command failed with exit status: 1

--

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 OffloadTest/test/Basic/Matrix/matrix_trunc_cast.test and matrix_elementwise_vector_cast.test, then run their clang-vk test commands to reproduce the zero outputs. Inspect the generated SPIR-V around the elementwise bitcasts and the related compiler path. Done means the tests produce their expected values, or are explicitly marked xfail as described in the issue.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.