Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce really rough linalg matrix proposal #404

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

llvm-beanz
Copy link
Collaborator

This is more as a straw man to start discussion than an actual proposal we'll move forward with as it is. This is a clear gap in the Direct3D and core HLSL feature sets and we should seek to address it.

Copy link
Member

@damyanp damyanp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT, a great starting point for discussions.

necessarily what they do. One big part of this proposal is to take 5 steps back
and talk about what they do: linear algebra.

## Motivation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matrix operator+(Matrix);
Matrix operator-(Matrix);
Matrix operator*(Matrix);
Matrix operator/(Matrix);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does operator/ do on a matrix?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elementwise division, will add comments

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the operators are element wise aligning with our conventions for vector and matrix types.

Comment on lines +56 to +67
template <typename T>
requires ArithmeticScalar<T>
Matrix operator+(T);
template <typename T>
requires ArithmeticScalar<T>
Matrix operator-(T);
template <typename T>
requires ArithmeticScalar<T>
Matrix operator*(T);
template <typename T>
requires ArithmeticScalar<T>
Matrix operator/(T);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these element-wise?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I'll add comments. This aligns with our convention for matrix and vector operators for other builtin types

requires ArithmeticScalar<T>
Matrix operator/(T);

static Matrix Splat(ElTy Val);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
static Matrix Splat(ElTy Val);
static Matrix Splat(ComponentTy Val);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I suspect that this code might have used all of T, ElTy and ComponentTy at some point to refer to the same thing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... yea I crossed some template wires. Let me do fix that.


## Detailed design

## Outstanding Questions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Support for packed types?
  • Support for other number formats that aren't natively supported by HLSL?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants