Skip to content

Commit 813aa5e

Browse files
committed
AMD HIP RT v2.3.7df94af
0 parents  commit 813aa5e

File tree

207 files changed

+76329
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+76329
-0
lines changed

.clang-format

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
BasedOnStyle: LLVM
2+
IndentWidth: 4
3+
TabWidth: 4
4+
UseTab: Always
5+
BreakBeforeBraces: Custom
6+
ColumnLimit: 128
7+
AllowShortBlocksOnASingleLine: false
8+
AllowShortIfStatementsOnASingleLine: true
9+
NamespaceIndentation: None
10+
SpacesInParentheses: true
11+
SpaceBeforeParens: ControlStatements
12+
SpaceAfterTemplateKeyword: true
13+
AlwaysBreakTemplateDeclarations: Yes
14+
PointerAlignment: Left
15+
16+
SortIncludes: false
17+
AlignConsecutiveAssignments: true
18+
AlignConsecutiveDeclarations: true
19+
20+
AlignEscapedNewlinesLeft: true
21+
AlignAfterOpenBracket: AlwaysBreak
22+
BinPackArguments: false
23+
BinPackParameters: false
24+
ExperimentalAutoDetectBinPacking: false
25+
AllowAllParametersOfDeclarationOnNextLine: true
26+
27+
IndentExternBlock: NoIndent
28+
29+
BreakBeforeBraces: Custom
30+
BraceWrapping:
31+
AfterClass: true
32+
AfterControlStatement: true
33+
AfterEnum: true
34+
AfterFunction: true
35+
AfterNamespace: true
36+
AfterObjCDeclaration: true
37+
AfterStruct: true
38+
AfterUnion: true
39+
BeforeCatch: true
40+
BeforeElse: true
41+
IndentBraces: false

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.github/workflows/format.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Run clang-format Linter
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- HRT-0-format*
8+
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
ref: ${{ github.event.pull_request.head.ref }}
18+
- uses: DoozyX/[email protected]
19+
with:
20+
source: './hiprt ./test'
21+
exclude: './contrib ./tools ./scripts'
22+
extensions: 'h,cpp,c'
23+
clangFormatVersion: 15
24+
inplace: True
25+
- uses: EndBug/[email protected]
26+
with:
27+
author_name: rprbuild
28+
author_email: [email protected]
29+
message: 'Automatic: Committing clang-format changes'

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.vs
2+
*.vscode
3+
*.png
4+
*.log
5+
*.xml
6+
*.bin
7+
*.fatbin
8+
*.hipfb
9+
*.bc
10+
build/
11+
dist/
12+
hiprt/hiprt.h
13+
hiprt/hiprtew.h
14+
hiprt/cache/Kernels.h
15+
hiprt/cache/KernelArgs.h

.gitmodules

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "contrib/Orochi"]
2+
path = contrib/Orochi
3+
url = https://github.com/amdadvtech/Orochi
4+
[submodule "contrib/easy-encryption"]
5+
path = contrib/easy-encryption
6+
url = https://github.com/amdadvtech/easy-encryption
7+
[submodule "test/common/meshes/lfs"]
8+
path = test/common/meshes/lfs
9+
url = https://github.com/amdadvtech/TestModels

README.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# HIPRT
2+
This is the main repository for the source code for HIPRT.
3+
4+
## Cloning and Building
5+
6+
1. `git clone https://github.com/GPUOpen-LibrariesAndSDKs/HIPRT`
7+
2. `git submodule update --init --recursive`
8+
3. `git lfs fetch` (To get resources for running performance tests)
9+
4. `.\tools\premake5\win\premake5.exe vs2019`
10+
11+
### Using Bitcode
12+
Add the option `--bitcode` to enable precompiled bitcode.
13+
14+
#### Generation of bitcode
15+
- After premake, go to `scripts/bitcodes`, then run `python compile.py` which compiles kernels to bitcode and fatbinary.
16+
- Or pass `--precompile` to premake. it executes the `compile.py` during premake. Note that you cannot do it in git bash on windows (because of hipcc...)
17+
18+
19+
## Running Unit Tests
20+
21+
There are three types of tests.
22+
1. HiprtTests - tests covering all basic features.
23+
2. ObjTestCases - tests with loading meshes and testing advanced features like shadow/ AO.
24+
3. PerformanceTestCases - tests with complex mesh to test performance features.
25+
26+
Example: `..\dist\bin\Release\unittest64.exe --width=512 --height=512 --referencePath=.\references\ --gtest_filter=hiprt*:Obj*" `
27+
28+
## Developing HIPRT
29+
30+
### Compiling Bundled Bitcode and Fatbinary
31+
- Clone `hipSdk` repo to the root directory.
32+
- Go to `scripts/bitcodes`, run `python compile.py` which uses `hipcc` from the `hipSdk` directory. (todo. make it more general, maybe search for `hipcc` from path, if it's not found, use the directory above or something like this)
33+
- Note use python version 3.*+.
34+
- Git bash shell is not supported for compile.py.
35+
36+
### Coding Guidelines
37+
- Resolve compiler warnings.
38+
- Use lower camel case for variable names (e.g., `nodeCount`) and upper camel case for constants (e.g., `LogSize`).
39+
- Separate functions by one line.
40+
- Use prefix `m_` for non-static member variables.
41+
- Do not use static local variables.
42+
- Do not use `void` for functions without arguments (leave it blank).
43+
- Do not use blocks without any reason.
44+
- Use references instead of pointers if possible.
45+
- Use bit-fields instead of explicit bit masking if possible.
46+
- Use `nullptr` instead of `NULL` or zero.
47+
- Use C++-style casts (e.g., `static_cast`) instead of C-style cast.
48+
- Add `const` for references and pointers if they are not being changed.
49+
- Add `constexpr` for variables and functions if they can be constant in compile time (do not use `#define` if possible).
50+
- Use `if constsexpr` instead of `#ifdef` if possible.
51+
- Throw `std::runtime_error` with an appropriate message in case of failure in the core and catch it in `hiprt.cpp`.
52+
53+
#### String
54+
- Use `std::string` instead of C strings (i.e., `char*`) and avoid C string functions as much as possible.
55+
- Use `std::cout` and `std::cerr` instead of `printf`.
56+
- Do not assign `char8_t` (or `std::u8string`) to `char` (or `std::string`). They will not be compatible in C++20.
57+
58+
#### File
59+
- Use `std::ifstream` and `std::ofstream` instead of `FILE`.
60+
- Use `std::filesystem::path` for files and paths instead of `std::string`.
61+
62+
#### Class
63+
- Use the in-class initializer instead of the default constructor.
64+
- Use the keyword `override` instead of `virtual` (or nothing) when overriding a virtual function from the base class.
65+
- Reason: The `override` keyword can help prevent bugs by producing compilation errors when the intended override is not actually implemented as an override. For example, when the function type is not exactly identical to the base class function. This can be caused by mistakes or if the virtual functions in the base class are changed due to refactor.
66+
- Use `std::optional` instead of pointers for optional parameters.
67+
- Reason: `std::optional` guarantees that no auxiliary memory allocation is needed. Meaning, it does not involve dynamic memory allocation & deallocation on the heap, which results in better performance and less memory overhead.
68+
- A base class destructor should be either public and virtual, or protected and non-virtual
69+
- Reason: This is to prevent undefined behavior. If the destructor is public, then the calling code can attempt to destroy a derived class object/instance through a base class pointer, and the result is undefined if the base class’s destructor is non-virtual.
70+
- Implement the customized {copy/move} {constructor/assignment operator} if an user-defined destructor of a class is needed, or remove them using `= delete`
71+
- Reason: [Rule of five](https://en.cppreference.com/w/cpp/language/rule_of_three)
72+
73+
### Versioning
74+
- When we update the master branch, we need to update the version number of hiprt in `version.txt`.
75+
- If there is a change in the API, you need to update minor version.
76+
- If the major and minor versions matches, the binaries are compatible.
77+
- Each commit in the master should have a unique patch version.

contrib/Orochi

Submodule Orochi added at c82a229

0 commit comments

Comments
 (0)