-
Notifications
You must be signed in to change notification settings - Fork 49
[CUDA] Isolate unified api to only in cubin launcher #408
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,7 +85,7 @@ void AddOne(tvm::ffi::TensorView x, tvm::ffi::TensorView y) { | |
|
|
||
| // Launch kernel | ||
| tvm::ffi::cuda_api::ResultType result = g_add_one_kernel->Launch(args, grid, block, stream); | ||
| TVM_FFI_CHECK_CUDA_ERROR(result); | ||
| TVM_FFI_CHECK_CUBIN_LAUNCHER_CUDA_ERROR(result); | ||
| } | ||
|
|
||
| } // namespace cubin_dynamic | ||
|
|
@@ -125,7 +125,7 @@ void MulTwo(tvm::ffi::TensorView x, tvm::ffi::TensorView y) { | |
|
|
||
| // Launch kernel | ||
| tvm::ffi::cuda_api::ResultType result = g_mul_two_kernel->Launch(args, grid, block, stream); | ||
| TVM_FFI_CHECK_CUDA_ERROR(result); | ||
| TVM_FFI_CHECK_CUBIN_LAUNCHER_CUDA_ERROR(result); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| // Export TVM-FFI functions | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,7 +73,7 @@ void AddOne(tvm::ffi::TensorView x, tvm::ffi::TensorView y) { | |
|
|
||
| // Launch kernel | ||
| tvm::ffi::cuda_api::ResultType result = kernel.Launch(args, grid, block, stream); | ||
| TVM_FFI_CHECK_CUDA_ERROR(result); | ||
| TVM_FFI_CHECK_CUBIN_LAUNCHER_CUDA_ERROR(result); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| } // namespace cubin_embedded | ||
|
|
@@ -112,7 +112,7 @@ void MulTwo(tvm::ffi::TensorView x, tvm::ffi::TensorView y) { | |
|
|
||
| // Launch kernel | ||
| tvm::ffi::cuda_api::ResultType result = kernel.Launch(args, grid, block, stream); | ||
| TVM_FFI_CHECK_CUDA_ERROR(result); | ||
| TVM_FFI_CHECK_CUBIN_LAUNCHER_CUDA_ERROR(result); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| // Export TVM-FFI functions | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,7 +70,7 @@ void AddOne(tvm::ffi::TensorView x, tvm::ffi::TensorView y) { | |
|
|
||
| // Launch kernel | ||
| tvm::ffi::cuda_api::ResultType result = kernel.Launch(args, grid, block, stream); | ||
| TVM_FFI_CHECK_CUDA_ERROR(result); | ||
| TVM_FFI_CHECK_CUBIN_LAUNCHER_CUDA_ERROR(result); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| } // namespace cubin_embedded | ||
|
|
@@ -109,7 +109,7 @@ void MulTwo(tvm::ffi::TensorView x, tvm::ffi::TensorView y) { | |
|
|
||
| // Launch kernel | ||
| tvm::ffi::cuda_api::ResultType result = kernel.Launch(args, grid, block, stream); | ||
| TVM_FFI_CHECK_CUDA_ERROR(result); | ||
| TVM_FFI_CHECK_CUBIN_LAUNCHER_CUDA_ERROR(result); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| // Export TVM-FFI functions | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,7 +70,7 @@ void AddOne(tvm::ffi::TensorView x, tvm::ffi::TensorView y) { | |
|
|
||
| // Launch kernel | ||
| tvm::ffi::cuda_api::ResultType result = kernel.Launch(args, grid, block, stream); | ||
| TVM_FFI_CHECK_CUDA_ERROR(result); | ||
| TVM_FFI_CHECK_CUBIN_LAUNCHER_CUDA_ERROR(result); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| } // namespace cubin_embedded | ||
|
|
@@ -109,7 +109,7 @@ void MulTwo(tvm::ffi::TensorView x, tvm::ffi::TensorView y) { | |
|
|
||
| // Launch kernel | ||
| tvm::ffi::cuda_api::ResultType result = kernel.Launch(args, grid, block, stream); | ||
| TVM_FFI_CHECK_CUDA_ERROR(result); | ||
| TVM_FFI_CHECK_CUBIN_LAUNCHER_CUDA_ERROR(result); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| // Export TVM-FFI functions | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -158,8 +158,8 @@ def test_cubin_launcher_add_one() -> None: | |||||||
| DLDevice device = x.device(); | ||||||||
| cudaStream_t stream = static_cast<cudaStream_t>(TVMFFIEnvGetStream(device.device_type, device.device_id)); | ||||||||
|
|
||||||||
| cudaError_t result = g_kernel_add_one->Launch(args, grid, block, stream); | ||||||||
| TVM_FFI_CHECK_CUDA_ERROR(result); | ||||||||
| auto result = g_kernel_add_one->Launch(args, grid, block, stream); | ||||||||
| TVM_FFI_CHECK_CUBIN_LAUNCHER_CUDA_ERROR(result); | ||||||||
|
Comment on lines
+161
to
+162
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For conciseness, you can combine these two lines into one, as has been done in other example files in this PR. This also removes the need for the
Suggested change
|
||||||||
| } | ||||||||
|
|
||||||||
| void LaunchMulTwo(tvm::ffi::TensorView x, tvm::ffi::TensorView y) { | ||||||||
|
|
@@ -184,8 +184,8 @@ def test_cubin_launcher_add_one() -> None: | |||||||
| DLDevice device = x.device(); | ||||||||
| cudaStream_t stream = static_cast<cudaStream_t>(TVMFFIEnvGetStream(device.device_type, device.device_id)); | ||||||||
|
|
||||||||
| cudaError_t result = g_kernel_mul_two->Launch(args, grid, block, stream); | ||||||||
| TVM_FFI_CHECK_CUDA_ERROR(result); | ||||||||
| auto result = g_kernel_mul_two->Launch(args, grid, block, stream); | ||||||||
| TVM_FFI_CHECK_CUBIN_LAUNCHER_CUDA_ERROR(result); | ||||||||
|
Comment on lines
+187
to
+188
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to my other comment, these two lines can be combined into a single statement for better readability and conciseness.
Suggested change
|
||||||||
| } | ||||||||
|
|
||||||||
| TVM_FFI_DLL_EXPORT_TYPED_FUNC(load_cubin_data, cubin_test::LoadCubinData); | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For conciseness, you could combine the kernel launch on line 87 and this error check into a single line. This would also remove the need for the
resultvariable. Other parts of this PR follow this more concise pattern (e.g., indocs/guides/cubin_launcher.rst).For example:
This would replace lines 87 and 88.