Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "linux-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "linux-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": false,
"cwd": "/home/liu/InfiniTensor/Learning-CUDA/src",
"program": "/home/liu/InfiniTensor/Learning-CUDA/src/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
59 changes: 59 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wcast-align",
"-Wconversion",
"-Wsign-conversion",
"-Wnull-dereference"
],
"C_Cpp_Runner.msvcWarnings": [
"/W4",
"/permissive-",
"/w14242",
"/w14287",
"/w14296",
"/w14311",
"/w14826",
"/w44062",
"/w44242",
"/w14905",
"/w14906",
"/w14263",
"/w44265",
"/w14928"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.useUndefinedSanitizer": false,
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ $(TARGET): $(STUDENT_OBJ) $(TEST_OBJ)
$(CC) $(CFLAGS) $(PLATFORM_DEFINE) -o $@ $^ $(EXTRA_LIBS)

# Generate src object: Compile kernels.cu (triggers template instantiation)
$(STUDENT_OBJ): $(STUDENT_SRC)
$(addsuffix .o,$(basename $(STUDENT_SRC))): $(STUDENT_SRC)
@echo "=== Compiling student code ($(STUDENT_SRC)) ==="
$(CC) $(CFLAGS) $(PLATFORM_DEFINE) -c $< -o $@
55 changes: 55 additions & 0 deletions code_prob_summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
## 1.

```bash
~/InfiniTensor/Learning-CUDA$ make VERBOSE=true
```

通过此来通过 nvidia的版本的检测。

```
/data/C500/Learning-CUDA# LD_LIBRARY_PATH=/opt/conda/lib:$LD_LIBRARY_PATH make VERBOSE=true PLATFORM=metax
```

通过此来通过沐曦metax的版本的检测。



## 2.存在的问题和困惑

online softmax FA2的编写部分,出现了e-5级别的误差导致难以使用真正的FA2来去通过编译。

只能使用相对原始一些的attention计算逻辑。对于metax和nvidia都是类似的情况。

| Case | Type | Avg Time (ms) | Max Diff | Max Tolerance | Result |
| ------ | --------- | ------------- | ------------- | ------------- | -------- |
| 1 | float | 0.452434 | 0.0000000 | 0.0000000 | Pass |
| 1 | half | 0.384831 | 0.0000000 | 0.0000000 | Pass |
| 2 | float | 0.408454 | 0.0000000 | 0.0000000 | Pass |
| 2 | half | 0.445536 | 0.0000000 | 0.0000000 | Pass |
| 3 | float | 0.387116 | 0.0000010 | 0.0007855 | Pass |
| 3 | half | 0.415170 | 0.0000000 | 0.0000000 | Pass |
| 4 | float | 0.450248 | 0.0000237 | 0.0001501 | Pass |
| 4 | half | 0.448288 | 0.0000076 | 0.0050435 | Pass |
| 5 | float | 0.584307 | 0.0000048 | 0.0009049 | Pass |
| 5 | half | 0.557689 | 0.0019531 | 0.0231250 | Pass |
| **6** | **float** | **2.688137** | **0.0000257** | **0.0000146** | **Fail** |
| 6 | half | 1.377309 | 0.0078125 | 0.0451562 | Pass |
| 7 | float | 0.391246 | 0.0000057 | 0.0008215 | Pass |
| 7 | half | 0.459092 | 0.0000000 | 0.0000000 | Pass |
| 8 | float | 0.438399 | 0.0000057 | 0.0008215 | Pass |
| 8 | half | 0.443422 | 0.0000000 | 0.0000000 | Pass |
| 9 | float | 0.429803 | 0.0000172 | 0.0002611 | Pass |
| 9 | half | 0.447457 | 0.0039062 | 0.0431250 | Pass |
| 10 | float | 0.558301 | 0.0000207 | 0.0002537 | Pass |
| 10 | half | 0.524745 | 0.0039062 | 0.0313086 | Pass |
| 11 | float | 0.400683 | 0.0000019 | 0.0009848 | Pass |
| 11 | half | 0.471791 | 0.0000305 | 0.0052132 | Pass |
| 12 | float | 0.427469 | 0.0000029 | 0.0009080 | Pass |
| 12 | half | 0.472397 | 0.0039062 | 0.0410937 | Pass |
| 13 | float | 15.444282 | 0.0000048 | 0.0008913 | Pass |
| 13 | half | 3.981441 | 0.0078125 | 0.0469141 | Pass |
| **14** | **float** | **63.248356** | **0.0000133** | **0.0000123** | **Fail** |
| 14 | half | 18.820628 | 0.0078125 | 0.0470703 | Pass |



Loading