llvm / llvm/llvm-project

[HLSL] Matrix layout is lost when type sugar is removed

Open
#213,996 1 comment 0 reactions 1 assignee Claimed by @farzonl View on GitHub
HLSL
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

## Issue
We need an AST representation of the layout as mentioned here:

Please fix the representation of matrix types in the AST so the layout doesn't depend on type sugar.

_Originally posted by @efriedma-quic in https://github.com/llvm/llvm-project/pull/211978#pullrequestreview-4782329852_

## Why Do we need this?

Explicit row_major and column_major orientation is stored only as AttributedType sugar. When matrices are desugared or wrapped in arrays and resources, CodeGen can lose the orientation and incorrectly use the translation-unit default.

Matrix orientation should be represented directly in ConstantMatrixType, preserved through serialization, importing, transformations, and template deduction, while retaining attributes for source fidelity.

Add CodeGen coverage for local arrays, structured resources, GEPs, loads, stores, and explicit layout overriding the default.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.