Skip to content

Create a MaxMatrixDimension language option. #160190

@farzonl

Description

@farzonl

The goal should likely be to replace the constexpr MaxElementsPerDimension with this language option.

class ConstantMatrixType final : public MatrixType {
protected:
friend class ASTContext;
/// Number of rows and columns.
unsigned NumRows;
unsigned NumColumns;
static constexpr unsigned MaxElementsPerDimension = (1 << 20) - 1;

But that would require updating all of these static constexpr functions with something that takes a SemaPtr

/// Returns true if \p NumElements is a valid matrix dimension.
static constexpr bool isDimensionValid(size_t NumElements) {
return NumElements > 0 && NumElements <= MaxElementsPerDimension;
}
/// Returns the maximum number of elements per dimension.
static constexpr unsigned getMaxElementsPerDimension() {
return MaxElementsPerDimension;
}

For now we will make this an HLSL only language opt and create an issue to make it more generic:

VALUE_LANGOPT(HLSLMaxMatrixDimension, 32, 4, NotCompatible, "maximum allowed matrix dimension")

Originally posted by @farzonl in #159446 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions