Skip to content

[HLSL] Scalar to vector implicit conversion #90788

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

Closed
Tracked by #67692
llvm-beanz opened this issue May 1, 2024 · 1 comment · Fixed by #96011
Closed
Tracked by #67692

[HLSL] Scalar to vector implicit conversion #90788

llvm-beanz opened this issue May 1, 2024 · 1 comment · Fixed by #96011
Assignees
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support

Comments

@llvm-beanz
Copy link
Collaborator

llvm-beanz commented May 1, 2024

While HLSL doesn't allow vector extension as an implicit conversion it does allow scalar to vector conversion as an implicit conversion.

void fn(int i) {}

void fn(vector<int64_t, 2> v) {}

export void call(int i, int64_t l, vector<int,2> vi, vector<int64_t, 2> vl) {
  fn(i);  // calls fn(int)
  fn(l);  // calls fn(vector<int64_t,2>)
  fn(vi); // calls fn(vector<int64_t,2>)
  fn(vl); // calls fn(vector<int64_t,2>)
}

Compiler Explorer

We need to update the language specification and implement the scalar->vector implicit conversion.

Depends on microsoft/hlsl-specs#232.

Acceptance Criteria

  • Updated HLSL specification for scalar splat conversion
  • Tests verifying correct overload resolution of the case described above.
@llvm-beanz llvm-beanz converted this from a draft issue May 1, 2024
@llvm-beanz llvm-beanz added the HLSL HLSL Language Support label May 1, 2024
@llvm-beanz llvm-beanz self-assigned this May 6, 2024
@llvm-beanz llvm-beanz linked a pull request Jun 19, 2024 that will close this issue
@llvm-beanz llvm-beanz moved this to Active in HLSL Support Jun 20, 2024
@github-project-automation github-project-automation bot moved this from Active to Done in HLSL Support Jul 13, 2024
@EugeneZelenko EugeneZelenko added the clang:frontend Language frontend issues, e.g. anything involving "Sema" label Jul 13, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 13, 2024

@llvm/issue-subscribers-clang-frontend

Author: Chris B (llvm-beanz)

While HLSL doesn't allow vector extension as an implicit conversion it does allow scalar to vector conversion as an implicit conversion.
void fn(int i) {}

void fn(vector&lt;int64_t, 2&gt; v) {}

export void call(int i, int64_t l, vector&lt;int,2&gt; vi, vector&lt;int64_t, 2&gt; vl) {
  fn(i);  // calls fn(int)
  fn(l);  // calls fn(vector&lt;int64_t,2&gt;)
  fn(vi); // calls fn(vector&lt;int64_t,2&gt;)
  fn(vl); // calls fn(vector&lt;int64_t,2&gt;)
}

Compiler Explorer

We need to update the language specification and implement the scalar->vector implicit conversion.

Depends on microsoft/hlsl-specs#232.

Acceptance Criteria

  • Updated HLSL specification for scalar splat conversion
  • Tests verifying correct overload resolution of the case described above.

@damyanp damyanp moved this to Closed in HLSL Support Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

3 participants