Skip to content

[DirectX] The dx.dot2/3/4 and dx.dot2add intrinsics leave vectors around post-scalarization #134569

Closed
@bogner

Description

@bogner

The dx.dot2, dot3, dot4, and dot2add intrinsics are defined as taking vector arguments and have special handling to scalarize those arguments in DXILOpLowering. This causes issues, as the vectors don't get entirely cleaned up before we generate DXIL.

From https://github.com/llvm-beanz/offload-test-suite/pull/61:

# .---command stdout------------
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%17 = insertelement <3 x float> undef, float %16, i32 0' in block '#0' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%18 = insertelement <3 x float> %17, float %15, i32 1' in block '#0' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%19 = insertelement <3 x float> %18, float %14, i32 2' in block '#0' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%20 = extractelement <3 x float> %19, i32 0' in block '#0' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%21 = extractelement <3 x float> %19, i32 1' in block '#0' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%22 = extractelement <3 x float> %19, i32 2' in block '#0' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%23 = extractelement <3 x float> %19, i32 0' in block '#0' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%24 = extractelement <3 x float> %19, i32 1' in block '#0' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%25 = extractelement <3 x float> %19, i32 2' in block '#0' of function 'main'.
# | Validation failed.

It would be simpler to make these intrinsics match their DXIL ops more closely and simply take scalar arguments. This will allow the scalarizer to do its job earlier in the pipeline.

Alternatively, we could improve the vectorArgExpansion logic in DXILOpLowering to clean up any remaining vector artifacts, but this seems like it would be redundant with the logic in the scalarizer.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions