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

HLSL instrinsics are not in the global namespace, and can't be disambiguated using :: #7035

Closed
devshgraphicsprogramming opened this issue Dec 15, 2024 · 2 comments
Labels
bug Bug, regression, crash needs-triage Awaiting triage

Comments

@devshgraphicsprogramming

Description

Suppose I make a method (static or not) that is called dot, if that calls dot within itself is impossible to disambiguate and force the of the global instrinsic function dot

Steps to Reproduce

template<typename T>
struct Functor
{
    static inline float dot(const in T lhs, const in T rhs)
    {
        return ::dot(lhs,rhs);
    }
};

void main()
{
    float32_t3 v = float32_t3(4,5,6);
    vk::RawBufferStore(0xdeadbeefull,Functor<float32_t3>::dot(v,v));
}

https://godbolt.org/z/GTjzE511j

Actual Behavior

<source>:9:16: error: no member named 'dot' in the global namespace; did you mean simply 'dot'?
        return ::dot(lhs,rhs);
               ^~~~~
               dot
<source>:7:25: note: 'dot' declared here
    static inline float dot(const in T lhs, const in T rhs)
                        ^

Environment

  • DXC version : latest trunk
  • Host Operating System: Godbolt
@llvm-beanz
Copy link
Collaborator

HLSL isn't really C++, so this isn't expected to be valid with HLSL 2021 and earlier builtin resolution rules (which are a bit special). We do have this related proposal:

https://github.com/microsoft/hlsl-specs/blob/main/proposals/0001-hlsl-namespace.md

Which would move all the HLSL builtin functions into the hlsl namespace in a future language version. We're actually implementing it that way in Clang from the start, so you will have a better experience in Clang, but I don't think this is likely to be fixed in DXC.

@damyanp
Copy link
Member

damyanp commented Dec 17, 2024

No plans to address this in DXC. The plan going forward in clang addresses this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash needs-triage Awaiting triage
Projects
Archived in project
Development

No branches or pull requests

3 participants