Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
a99e1077
Commit
a99e1077
authored
Sep 06, 2023
by
lisj
Browse files
适配dtk23.04-km
parent
0235a31a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
7 deletions
+18
-7
CMakeLists.txt
CMakeLists.txt
+3
-1
README.md
README.md
+10
-2
cmake/modules/ROCM.cmake
cmake/modules/ROCM.cmake
+4
-0
include/dgl/runtime/ndarray.h
include/dgl/runtime/ndarray.h
+1
-4
No files found.
CMakeLists.txt
View file @
a99e1077
...
@@ -74,6 +74,8 @@ if(USE_HIP)
...
@@ -74,6 +74,8 @@ if(USE_HIP)
hip_include_directories
(
BEFORE
"
${
ROCM_PATH
}
/include/hipcub"
)
hip_include_directories
(
BEFORE
"
${
ROCM_PATH
}
/include/hipcub"
)
endif
(
USE_HIP
)
endif
(
USE_HIP
)
add_definitions
(
-D_GLIBCXX_USE_CXX11_ABI=0
)
# initial variables
# initial variables
if
(
NOT MSVC
)
if
(
NOT MSVC
)
set
(
DGL_LINKER_LIBS
"dl"
)
set
(
DGL_LINKER_LIBS
"dl"
)
...
@@ -223,7 +225,7 @@ if(USE_HIP)
...
@@ -223,7 +225,7 @@ if(USE_HIP)
dgl_config_hip
(
DGL_CUDA_SRC
)
dgl_config_hip
(
DGL_CUDA_SRC
)
list
(
APPEND DGL_SRC
${
DGL_CUDA_SRC
}
)
list
(
APPEND DGL_SRC
${
DGL_CUDA_SRC
}
)
set
(
HIP_HIPCC_FLAGS
"-std=c++17"
)
set
(
HIP_HIPCC_FLAGS
"-std=c++17"
)
hip_add_library
(
dgl SHARED
${
DGL_SRC
}
HIPCC_OPTIONS
"-DDGL_USE_CUDA"
"-DCUDART_VERSION_LT_11000=true"
)
hip_add_library
(
dgl SHARED
${
DGL_SRC
}
)
target_include_directories
(
dgl PRIVATE
"
${
ROCM_PATH
}
/include"
)
target_include_directories
(
dgl PRIVATE
"
${
ROCM_PATH
}
/include"
)
target_include_directories
(
dgl PRIVATE
"
${
ROCM_PATH
}
/include/hiprand"
)
target_include_directories
(
dgl PRIVATE
"
${
ROCM_PATH
}
/include/hiprand"
)
target_include_directories
(
dgl PRIVATE
"
${
ROCM_PATH
}
/include/rocrand"
)
target_include_directories
(
dgl PRIVATE
"
${
ROCM_PATH
}
/include/rocrand"
)
...
...
README.md
View file @
a99e1077
...
@@ -39,11 +39,14 @@ pip install dist/dgl*
...
@@ -39,11 +39,14 @@ pip install dist/dgl*
## 适配HIP移植修改
## 适配HIP移植修改
```
shell
```
shell
1. cmake相关
1. cmake相关
# 22.10
修改CMakeLists.txt,增加USE_HIP编译控制
修改CMakeLists.txt,增加USE_HIP编译控制
新增cmake/modules/ROCM.cmake,参考cmake/modules/CUDA.cmake进行编译配置
新增cmake/modules/ROCM.cmake,参考cmake/modules/CUDA.cmake进行编译配置
增加CUDART_VERSION相关宏参数
增加CUDART_VERSION相关宏参数
# 23.04
添加
"__HIP_PLATFORM_AMD__"
宏参数,避免CPU代码编译问题
2. 源码修改
2. 源码修改
# 22.10
添加宏判断,设备上不支持iostream
添加宏判断,设备上不支持iostream
src/array/selector.h:34
src/array/selector.h:34
...
@@ -67,5 +70,10 @@ hip结构体hipPointerAttribute_t适配
...
@@ -67,5 +70,10 @@ hip结构体hipPointerAttribute_t适配
增加__HIPCC__宏定义的检查
增加__HIPCC__宏定义的检查
include/dgl/array_iterator.h:9
include/dgl/array_iterator.h:9
# 23.04
修改__shfl_down_sync支持
src
\a
rray
\c
uda
\s
ddmm.cuh:179
修改__syncwarp支持
src
\a
rray
\c
uda
\g
ather_mm.cu:103
src
\a
rray
\c
uda
\g
ather_mm.cu:164
```
```
\ No newline at end of file
cmake/modules/ROCM.cmake
View file @
a99e1077
...
@@ -10,6 +10,10 @@ macro(dgl_config_hip out_variable)
...
@@ -10,6 +10,10 @@ macro(dgl_config_hip out_variable)
# avoid global retrigger of cmake
# avoid global retrigger of cmake
include_directories
(
${
CUDA_INCLUDE_DIRS
}
)
include_directories
(
${
CUDA_INCLUDE_DIRS
}
)
add_definitions
(
-DDGL_USE_CUDA
)
add_definitions
(
-D__HIP_PLATFORM_AMD__
)
add_definitions
(
-DCUDART_VERSION_LT_11000=true
)
set_source_files_properties
(
src/random/random.cc PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1
)
set_source_files_properties
(
src/random/random.cc PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1
)
set_source_files_properties
(
src/array/cuda/csr_transpose.cc PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1
)
set_source_files_properties
(
src/array/cuda/csr_transpose.cc PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1
)
set_source_files_properties
(
src/runtime/cuda/cuda_device_api.cc PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1
)
set_source_files_properties
(
src/runtime/cuda/cuda_device_api.cc PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1
)
...
...
include/dgl/runtime/ndarray.h
View file @
a99e1077
...
@@ -18,10 +18,6 @@
...
@@ -18,10 +18,6 @@
#include "serializer.h"
#include "serializer.h"
#include "shared_mem.h"
#include "shared_mem.h"
#ifdef DGL_USE_CUDA
#include <hip/hip_fp16.h>
#endif
// forward declaration
// forward declaration
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
DGLType
t
);
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
DGLType
t
);
...
@@ -52,6 +48,7 @@ GEN_DLDATATYPETRAITS_FOR(uint32_t, kDLInt, 32);
...
@@ -52,6 +48,7 @@ GEN_DLDATATYPETRAITS_FOR(uint32_t, kDLInt, 32);
GEN_DLDATATYPETRAITS_FOR
(
uint64_t
,
kDLInt
,
64
);
GEN_DLDATATYPETRAITS_FOR
(
uint64_t
,
kDLInt
,
64
);
#ifdef DGL_USE_CUDA
#ifdef DGL_USE_CUDA
#ifdef USE_FP16
#ifdef USE_FP16
#include <hip/hip_fp16.h>
GEN_DLDATATYPETRAITS_FOR
(
__half
,
kDLFloat
,
16
);
GEN_DLDATATYPETRAITS_FOR
(
__half
,
kDLFloat
,
16
);
#endif
#endif
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment