You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I located the code in lib/kernels/src/cuda but am not sure what are the procedures need to be done here. Could you elaborate more on this @reyna-abhyankar? Thanks!
I located the code in lib/kernels/src/cuda but am not sure what are the procedures need to be done here. Could you elaborate more on this @reyna-abhyankar? Thanks!
Essentially, we want the _kernels.cpp file to mirror the _kernels.cu file for all the operators. This means the function signature should match what's defined in _kernels.h. There are some small differences between hip and cuda. We use hipStream_t instead of cudaStream_t, miopenXXXX or hipXXXX instead of cudaXXXX as prefixes for certain types or function calls. Most notably, launching the actual kernel is different. In cuda, we use triple bracket syntax for certain hyperparameters (like # of thread blocks and # of threads). In hip, these are just normal function parameters.
So in linear_kernels.cu, we call gelu_forward_kernel like so:
So aside from these differences, we want to align the .cpp file to the .cu file. For example, the function signature for init_kernel is incorrect in the hip kernels when compared with the cuda version. Let me know if you have more questions! We can chat more over Slack as well.
I located the code in lib/kernels/src/cuda but am not sure what are the procedures need to be done here. Could you elaborate more on this @reyna-abhyankar? Thanks!
Essentially, we want the _kernels.cpp file to mirror the _kernels.cu file for all the operators. This means the function signature should match what's defined in _kernels.h. There are some small differences between hip and cuda. We use hipStream_t instead of cudaStream_t, miopenXXXX or hipXXXX instead of cudaXXXX as prefixes for certain types or function calls. Most notably, launching the actual kernel is different. In cuda, we use triple bracket syntax for certain hyperparameters (like # of thread blocks and # of threads). In hip, these are just normal function parameters.
So in linear_kernels.cu, we call gelu_forward_kernel like so:
So aside from these differences, we want to align the .cpp file to the .cu file. For example, the function signature for init_kernel is incorrect in the hip kernels when compared with the cuda version. Let me know if you have more questions! We can chat more over Slack as well.
Thanks Reyna! I will follow up via slack if having more questions.
Hi @lockshaw Colin and @reyna-abhyankar Reyna, I have one question regarding hip and Cuda. I have noticed that all check functions are in the CUDA format in the .cpp file. For example, checkCUDNN(miopenSetStream(m->handle.dnn, stream)); is used in hip. So, the question is to confirm that checkCUDNN, checkCUDA, or similar functions are the correct functions to use in hip. Is this correct?
Hi @lockshaw Colin and @reyna-abhyankar Reyna, I have one question regarding hip and Cuda. I have noticed that all check functions are in the CUDA format in the .cpp file. For example, checkCUDNN(miopenSetStream(m->handle.dnn, stream)); is used in hip. So, the question is to confirm that checkCUDNN, checkCUDA, or similar functions are the correct functions to use in hip. Is this correct?
Yes, those are fine. They're defined in device.h and take in a status (so miopenSetStream() returns a status).
Activity
lockshaw commentedon Mar 28, 2024
@reyna-abhyankar Could we get a bit more detail on this issue? Maybe a couple links?
Bob-Chen222 commentedon Mar 30, 2024
I located the code in lib/kernels/src/cuda but am not sure what are the procedures need to be done here. Could you elaborate more on this @reyna-abhyankar? Thanks!
reyna-abhyankar commentedon Mar 31, 2024
Essentially, we want the
_kernels.cppfile to mirror the_kernels.cufile for all the operators. This means the function signature should match what's defined in_kernels.h. There are some small differences between hip and cuda. We usehipStream_tinstead ofcudaStream_t,miopenXXXXorhipXXXXinstead ofcudaXXXXas prefixes for certain types or function calls. Most notably, launching the actual kernel is different. In cuda, we use triple bracket syntax for certain hyperparameters (like # of thread blocks and # of threads). In hip, these are just normal function parameters.So in
linear_kernels.cu, we callgelu_forward_kernellike so:whereas, in
linear_kernels.cpp, we call it like so:So aside from these differences, we want to align the
.cppfile to the.cufile. For example, the function signature forinit_kernelis incorrect in the hip kernels when compared with the cuda version. Let me know if you have more questions! We can chat more over Slack as well.Bob-Chen222 commentedon Apr 1, 2024
Thanks Reyna! I will follow up via slack if having more questions.
Bob-Chen222 commentedon Apr 9, 2024
Hi @lockshaw Colin and @reyna-abhyankar Reyna, I have one question regarding hip and Cuda. I have noticed that all check functions are in the CUDA format in the .cpp file. For example,
checkCUDNN(miopenSetStream(m->handle.dnn, stream));is used in hip. So, the question is to confirm that checkCUDNN, checkCUDA, or similar functions are the correct functions to use in hip. Is this correct?reyna-abhyankar commentedon Apr 10, 2024
Yes, those are fine. They're defined in
device.hand take in a status (somiopenSetStream()returns a status).