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

Cuda safety fixes #198

Merged
merged 3 commits into from
Aug 17, 2021
Merged

Commits on Aug 13, 2021

  1. Cuda safety fixes

    Many places (basically everywhere), we had the following idiom:
    
        template<class T>
        class Foo {
            IMATH_HOSTDEVICE float bar();    // declaration
        };
        ...
        template<class T> float Foo<T>::bar() { return 0.0; } // implementation
    
    But this is wrong! When actually compiled in Cuda mode (maybe depending
    on the compiler?), you can get errors about how you can't overload
    a `__host__ __device__` declaration with a `__host__`-only implementation.
    Which kinda makes sense. You have to match the two. So I have a WHOLE LOT
    of places where I had to add IMATH_HOSTDEVICE.
    
    Also, in ImathMath.h, we used this idiom:
    
        IMATH_HOSTDEVICE IMATH_DEPRECATED("reason") float foo() { ... }
    
    Now, this seems to work with `cudacc`, but when you use
    `clang++ --language=cuda` to compile Cuda to PTX (it can do that!), clang
    really doesn't like it when the `__host__ __device__` comes before the
    `[[ deprecated("msg") ]]`, it has an error about how the deprecated
    attribute can't go there. So we have to transpose these so that the
    IMATH_DEPRECATED is alwys the first thing in the declaration (which is
    the way we almost always write it anyway).
    
    Signed-off-by: Larry Gritz <[email protected]>
    lgritz committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    56b4f80 View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2021

  1. Add missing HOSTDEVICE

    Signed-off-by: Larry Gritz <[email protected]>
    lgritz committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    714c754 View commit details
    Browse the repository at this point in the history
  2. Add missing HOSTDEVICE

    Signed-off-by: Larry Gritz <[email protected]>
    lgritz committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    d59c2bf View commit details
    Browse the repository at this point in the history