Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDTK
hipDNN Samples
Commits
bcefbabc
"vscode:/vscode.git/clone" did not exist on "8c25ed52d6086268c9a8338bb5b8761afd7bd82c"
Commit
bcefbabc
authored
Jun 02, 2026
by
yanjl1
Browse files
update README
parent
ca34d4d2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
40 deletions
+20
-40
README.md
README.md
+20
-32
cpp/.omc/sessions/eafc2bdd-f5a2-481a-9368-0fc8c1ceb3a0.json
cpp/.omc/sessions/eafc2bdd-f5a2-481a-9368-0fc8c1ceb3a0.json
+0
-8
No files found.
README.md
View file @
bcefbabc
#
hygon_
samples
# samples
本项目提供了 hipDNN(HIP Deep Neural Network)前端 API 的使用示例,覆盖海光 DCU(Deep Computing Unit)硬件上常用的深度学习算子、融合算子以及 PyTorch 集成用法。
本项目提供了 hipDNN(HIP Deep Neural Network)前端 API 的使用示例,覆盖海光 DCU(Deep Computing Unit)硬件上常用的深度学习算子、融合算子以及 PyTorch 集成用法。
## 环境要求
## 环境要求
-
**DTK 版本**
:≥ 25.04.2(推荐 26.04)
-
**DTK 版本**
:≥ 26.04.2
-
**CMake 版本**
:≥ 3.25.2
-
**支持架构**
:
`gfx906`
、
`gfx926`
、
`gfx928`
、
`gfx936`
、
`gfx938`
、
`gfx92a`
-
**支持架构**
:
`gfx906`
、
`gfx926`
、
`gfx928`
、
`gfx936`
、
`gfx938`
、
`gfx92a`
-
**依赖**
:
`hipdnn`
(Python/C++)、
`hip::host`
、
`hipdnn_frontend`
、
`PyTorch`
(Python 示例)
-
**依赖**
:
`hipdnn`
(Python/C++)、
`hip::host`
、
`hipdnn_frontend`
、
`PyTorch`
(Python 示例)
所有开发和运行都需要先加载 DTK 环境:
所有开发和运行都需要先加载 DTK 环境:
```
bash
```
bash
source
/
data
/dtk-26.04/env.sh
source
/
opt
/dtk-26.04
.2
/env.sh
```
```
> 若未加载,C++ 编译时会报错 `Must be source dtk/env.sh`(`ROCM_PATH` 未设置)。
> 若未加载,C++ 编译时会报错 `Must be source dtk/env.sh`(`ROCM_PATH` 未设置)。
...
@@ -51,32 +52,31 @@ source /data/dtk-26.04/env.sh
...
@@ -51,32 +52,31 @@ source /data/dtk-26.04/env.sh
│ ├── block_scale/ # 块量化/反量化
│ ├── block_scale/ # 块量化/反量化
│ └── ...
│ └── ...
├── python/ # Python 示例(hipdnn Python API + PyTorch)
├── python/ # Python 示例(hipdnn Python API + PyTorch)
│ ├── convolution/
├── convolution/
│ ├── conv_fusion/
├── conv_fusion/
│ ├── matmul/
├── matmul/
│ ├── sdpa/
├── sdpa/
│ ├── batchnorm/
├── batchnorm/
│ ├── layernorm/
├── layernorm/
│ ├── groupnorm/
├── groupnorm/
│ ├── adamw/
├── adamw/
│ ├── torch_wrapper/ # PyTorch 模块封装(如 TorchPReLU)
├── torch_wrapper/ # PyTorch 模块封装(如 TorchPReLU)
│ └── ...
└── ...
└── CLAUDE.md # 本项目开发指引
```
```
## 编译 C++ 示例
## 编译 C++ 示例
```
bash
```
bash
cd
cpp/build
cd
cpp/build
cmake
-G
Ninja
..
cmake ..
ninja
make
```
```
编译完成后,可执行文件位于
`cpp/build/bin/`
。如需单独编译某个示例:
编译完成后,可执行文件位于
`cpp/build/bin/`
。如需单独编译某个示例:
```
bash
```
bash
ninja
conv_forward
make
conv_forward
ninja
sdpa_inference
make
sdpa_inference
```
```
> `CMakeLists.txt` 中部分示例被注释掉(如 `bn_finalize`、`block_scale_quantize`、`slice`、`rng`),如需启用请取消对应 `add_hipdnn_sample(...)` 行的注释。
> `CMakeLists.txt` 中部分示例被注释掉(如 `bn_finalize`、`block_scale_quantize`、`slice`、`rng`),如需启用请取消对应 `add_hipdnn_sample(...)` 行的注释。
...
@@ -129,7 +129,7 @@ pip install ${ROCM_PATH}/share/hipdnn/wheels/hipdnn-*.whl
...
@@ -129,7 +129,7 @@ pip install ${ROCM_PATH}/share/hipdnn/wheels/hipdnn-*.whl
2.
编译 C++ 示例并运行:
2.
编译 C++ 示例并运行:
```
bash
```
bash
cd
cpp/build
&&
cmake
-G
Ninja
..
&&
ninja
cd
cpp/build
&&
cmake ..
&&
make
./bin/conv_forward
./bin/conv_forward
```
```
...
@@ -144,18 +144,6 @@ pip install ${ROCM_PATH}/share/hipdnn/wheels/hipdnn-*.whl
...
@@ -144,18 +144,6 @@ pip install ${ROCM_PATH}/share/hipdnn/wheels/hipdnn-*.whl
| 现象 | 原因 | 解决方式 |
| 现象 | 原因 | 解决方式 |
|------|------|----------|
|------|------|----------|
|
`Must be source dtk/env.sh`
|
`ROCM_PATH`
未设置 | 先执行
`source /data/dtk-26.04/env.sh`
|
|
`Must be source dtk/env.sh`
|
`ROCM_PATH`
未设置 | 先执行
`source /data/dtk-26.04/env.sh`
|
|
`hipdnn`
模块找不到 | Python 环境未加载 hipDNN | 确认 DTK 环境已加载,且
`hipdnn`
在
`PYTHONPATH`
中 |
| CMake 找不到
`hipdnn_frontend`
| hipDNN 未安装或环境未加载 | 检查
`${ROCM_PATH}/lib/cmake/hipdnn/`
是否存在 |
| CMake 找不到
`hipdnn_frontend`
| hipDNN 未安装或环境未加载 | 检查
`${ROCM_PATH}/lib/cmake/hipdnn/`
是否存在 |
| CUDA 相关报错 | PyTorch 张量未放至 GPU | 确保张量使用
`device="cuda"`
|
| CUDA 相关报错 | PyTorch 张量未放至 GPU | 确保张量使用
`device="cuda"`
|
| 编译警告被当作错误 | CMake 开启了
`-Werror`
| 修复代码中的警告,或临时在
`CMakeLists.txt`
中移除
`-Werror`
|
| 编译警告被当作错误 | CMake 开启了
`-Werror`
| 修复代码中的警告,或临时在
`CMakeLists.txt`
中移除
`-Werror`
|
\ No newline at end of file
## 数据类型与布局说明
-
**默认数据类型**
:
`float`
(C++)/
`torch.float32`
(Python)。
-
**FP16**
:使用
`hipdnn_data_sdk::types::half`
/
`torch.float16`
。
-
**INT8**
:使用
`int8_t`
/
`torch.int8`
,并采用
**NCHWc32**
分块布局(
`vector_count=32`
)。INT8 示例中的量化/反量化通过显式的 SUB/MUL/DIV/ADD 节点完成。
-
**布局**
:默认 NCHW;部分卷积示例使用 channels-last(
`torch.channels_last`
);INT8 使用 NCHWc32。
## 许可证
代码文件遵循 MIT 许可证(SPDX-License-Identifier: MIT)。
cpp/.omc/sessions/eafc2bdd-f5a2-481a-9368-0fc8c1ceb3a0.json
deleted
100644 → 0
View file @
ca34d4d2
{
"session_id"
:
"eafc2bdd-f5a2-481a-9368-0fc8c1ceb3a0"
,
"ended_at"
:
"2026-06-02T10:11:57.127Z"
,
"reason"
:
"prompt_input_exit"
,
"agents_spawned"
:
0
,
"agents_completed"
:
0
,
"modes_used"
:
[]
}
\ No newline at end of file
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