-
Notifications
You must be signed in to change notification settings - Fork 49
[Enhancement] Refactor cubin launcher #300
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
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
b182ccd
[cmake] Use object library to compile cuda files to cubin/fatbin
oraluben c997be8
check for cudart version
oraluben 0aa4b0e
tmp
oraluben cbacfcb
[1/n] Use unify API
oraluben 6a21adb
[2/n] Remove all rt api
oraluben b553c7e
[3/3] Unify rt and driver api
oraluben 6bffd5e
upd namespace
oraluben 848b8e2
fix version check
oraluben 8bea855
adapt dynamic example
oraluben 2125287
update
oraluben b8b246c
embed example
oraluben 2427cc4
update cmake doc
oraluben e9546c1
update cmake doc
oraluben fb01e61
upd
oraluben 871f686
rename macro
oraluben 556629b
Add an example with cpp's resource inclusion
oraluben d6bb52a
add example for bin2c
oraluben 463c3bf
cleanup
oraluben 617a686
update doc
oraluben 1ca425c
lint
oraluben 30c11c6
Refactor CUBIN embedding macros to use TVM_FFI_LOAD_LIBRARY_FROM_BYTE…
oraluben 5378347
doc
oraluben 5b13cbf
vibe documenting
oraluben 03819ef
lint
oraluben a28bf1b
add doc for TVM_FFI_LOAD_LIBRARY_FROM_BYTES
oraluben 3a3c3ad
ci
oraluben acdc148
upd
oraluben 71a0a85
use proper name for cuda result type
oraluben 4134d13
Use a better signature for `tvm_ffi_embed_bin_into`
oraluben 8cda1f2
Rename `TVM_FFI_LOAD_LIBRARY_FROM_BYTES` to `TVM_FFI_EMBED_CUBIN_FROM…
oraluben 6dbe317
Remove `INTERMEDIATE_FILE` arg
oraluben 8db2de4
Move copy util to a separate file
oraluben 48c3c0c
Merge branch 'main' into embed-cubin-v2
oraluben 81ae232
Set `CMAKE_CUDA_RUNTIME_LIBRARY` to Shared when no default value and …
oraluben 6a98732
move unified api to new location and namespace
oraluben 11253ec
Fix issues found by gemini
oraluben 2d177b6
doc update from gemini
oraluben File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -295,3 +295,6 @@ _docs/ | |
| .gdb_history | ||
|
|
||
| build/ | ||
|
|
||
| *.cubin | ||
| *.fatbin | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # We need this to simulate `CUDA_{CUBIN,FATBIN}_COMPILATION` in `add_tvm_ffi_{cubin,fatbin}`, to | ||
| # copy `a.cu.o` to `a.cubin`/`a.fatbin`. | ||
|
|
||
| # Usage: cmake -DOBJECTS=<input_object_file1>;...;<input_object_fileN> -DOUT_DIR=<output_directory> | ||
| # -DEXT=<extension> -P <this_script> | ||
|
|
||
| # Parameter: OBJECTS: semicolon-separated list of input object files; OUT_DIR: output directory, | ||
| # empty for the same directory as the object file EXT: extension to rename to | ||
|
|
||
| string(REPLACE "\"" "" ext_strip "${EXT}") | ||
| string(REPLACE "\"" "" out_dir_strip "${OUT_DIR}") | ||
| foreach (obj_raw ${OBJECTS}) | ||
| string(REPLACE "\"" "" obj "${obj_raw}") | ||
|
|
||
| # Extract filename: /path/to/kernel.cu.o -> kernel Note: CMake objects are usually named | ||
| # source.cu.o, so we strip extensions twice. | ||
| get_filename_component(fname ${obj} NAME_WE) | ||
| get_filename_component(fname ${fname} NAME_WE) | ||
|
|
||
| # If OUT_DIR is provided, use it. Otherwise, use the object's directory. | ||
| if (NOT out_dir_strip STREQUAL "") | ||
| set(FINAL_DIR "${out_dir_strip}") | ||
| else () | ||
| get_filename_component(FINAL_DIR ${obj} DIRECTORY) | ||
| endif () | ||
|
|
||
| message("Copying ${obj} -> ${FINAL_DIR}/${fname}.${ext_strip}") | ||
| execute_process( | ||
| COMMAND ${CMAKE_COMMAND} -E copy_if_different "${obj}" "${FINAL_DIR}/${fname}.${ext_strip}" | ||
| ) | ||
| endforeach () |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.