Skip to content

[Clang] [CUDA] unsupported declare CUDA host device function and define host/device separate #141922

Closed
@Acthink-Yang

Description

@Acthink-Yang

https://godbolt.org/z/K44e7esn1

__host__ __device__ void func();  // error

// __device__ void func(); // ok
// __host__ void func(); // ok


__host__ void func() {}

__device__ void func(void) {}

error: host function 'func' cannot overload host device function 'func'

I found "HD functions cannot be overloaded by H or D functions with the same signature" in this doc:

https://llvm.org/docs/CompileCudaWithLLVM.html#overloading-based-on-host-and-device-attributes

but I want to known declear HD, than separate define H/D is OK?

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"cudaquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions