Skip to content

Commit

Permalink
[amdgpu] Part1 add codegen (taichi-dev#6469)
Browse files Browse the repository at this point in the history
Issue: taichi-dev#6434

### Brief Summary
This part contains `CHI IR->LLVM IR` part. Similar to part0, the
skeleton of this part is similar to `cuda`. Some important notes are
following.
1. `ocml` is the math library like 'libdevice' in `nvidia`. It provides
most of the functions we need. Remains such as `sgn`, and `abs` have
been completed by hand codes
2. The kernel parameter passing part is different from the `CUDA`.
`extra_args` is the only way that could be accepted by `device kernel.`
3. still uses jargon from `nvidia`.(e.g. `sm`, `block` and `grid`)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and quadpixels committed May 13, 2023
1 parent 2dc1f37 commit b3b4845
Show file tree
Hide file tree
Showing 5 changed files with 573 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmake/TaichiCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ if(TI_WITH_LLVM)
if (TI_WITH_AMDGPU)
llvm_map_components_to_libnames(llvm_amdgpu_libs AMDGPU)
add_subdirectory(taichi/rhi/amdgpu)
add_subdirectory(taichi/codegen/amdgpu)

target_link_libraries(${CORE_LIBRARY_NAME} PRIVATE amdgpu_codegen)
target_link_libraries(${CORE_LIBRARY_NAME} PRIVATE amdgpu_rhi)
endif()

Expand Down
17 changes: 17 additions & 0 deletions taichi/codegen/amdgpu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ./taichi/codegen/amdgpu/CMakeLists.txt

add_library(amdgpu_codegen)
target_sources(amdgpu_codegen
PRIVATE
codegen_amdgpu.cpp
)

target_include_directories(amdgpu_codegen
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/external/eigen
${LLVM_INCLUDE_DIRS}
)

target_link_libraries(amdgpu_codegen PRIVATE taichi_util)
# target_link_libraries(amdgpu_codegen PRIVATE amdgpu_runtime)
Loading

0 comments on commit b3b4845

Please sign in to comment.