├── .clang-format ├── .gitattributes ├── .github └── workflows │ └── format.yaml ├── .gitignore ├── .gitmodules ├── CHANGELOG.md ├── CMakeLists.txt ├── README.md ├── contrib ├── Orochi │ ├── .clang-format │ ├── .gitattributes │ ├── .github │ │ └── workflows │ │ │ └── action.yml │ ├── .gitignore │ ├── LICENSE │ ├── Orochi │ │ ├── GpuMemory.h │ │ ├── Orochi.cpp │ │ ├── Orochi.h │ │ ├── OrochiUtils.cpp │ │ ├── OrochiUtils.h │ │ ├── enable_cuew.cmake │ │ ├── enable_cuew.lua │ │ ├── nvidia_hip_runtime_api_oro.h │ │ └── nvidia_hiprtc_oro.h │ ├── ParallelPrimitives │ │ ├── RadixSort.cpp │ │ ├── RadixSort.h │ │ ├── RadixSort.inl │ │ ├── RadixSortConfigs.h │ │ ├── RadixSortKernels.h │ │ └── cache │ │ │ └── empty.txt │ ├── README.md │ ├── Test │ │ ├── Common.h │ │ ├── DeviceEnum │ │ │ ├── main.cpp │ │ │ └── premake5.lua │ │ ├── RadixSort │ │ │ ├── README.md │ │ │ ├── main.cpp │ │ │ └── premake5.lua │ │ ├── SimpleD3D12 │ │ │ ├── DX12OroSample.cpp │ │ │ ├── DX12OroSample.h │ │ │ ├── DXSampleHelper.h │ │ │ ├── Main.cpp │ │ │ ├── README.md │ │ │ ├── ShaderStructs.h │ │ │ ├── Win32Application.cpp │ │ │ ├── Win32Application.h │ │ │ ├── d3dx12.h │ │ │ ├── helper_string.h │ │ │ ├── premake5.lua │ │ │ ├── shaders.hlsl │ │ │ ├── simpleD3D12.cpp │ │ │ ├── simpleD3D12.h │ │ │ ├── sinewave_Orochi.oro │ │ │ ├── stdafx.cpp │ │ │ └── stdafx.h │ │ ├── Stopwatch.h │ │ ├── Texture │ │ │ ├── main.cpp │ │ │ ├── premake5.lua │ │ │ └── texture_test_kernel.hpp │ │ ├── VulkanComputeSimple │ │ │ ├── README.adoc │ │ │ ├── main.comp │ │ │ ├── main.comp.spv │ │ │ ├── main.cpp │ │ │ ├── premake5.lua │ │ │ ├── vk_video │ │ │ │ ├── vulkan_video_codec_h264std.h │ │ │ │ ├── vulkan_video_codec_h264std_decode.h │ │ │ │ ├── vulkan_video_codec_h264std_encode.h │ │ │ │ ├── vulkan_video_codec_h265std.h │ │ │ │ ├── vulkan_video_codec_h265std_decode.h │ │ │ │ ├── vulkan_video_codec_h265std_encode.h │ │ │ │ └── vulkan_video_codecs_common.h │ │ │ └── vulkan │ │ │ │ ├── vk_icd.h │ │ │ │ ├── vk_layer.h │ │ │ │ ├── vk_platform.h │ │ │ │ ├── vk_sdk_platform.h │ │ │ │ ├── vulkan.h │ │ │ │ ├── vulkan.hpp │ │ │ │ ├── vulkan_android.h │ │ │ │ ├── vulkan_beta.h │ │ │ │ ├── vulkan_core.h │ │ │ │ ├── vulkan_directfb.h │ │ │ │ ├── vulkan_enums.hpp │ │ │ │ ├── vulkan_fuchsia.h │ │ │ │ ├── vulkan_funcs.hpp │ │ │ │ ├── vulkan_ggp.h │ │ │ │ ├── vulkan_handles.hpp │ │ │ │ ├── vulkan_hash.hpp │ │ │ │ ├── vulkan_ios.h │ │ │ │ ├── vulkan_macos.h │ │ │ │ ├── vulkan_metal.h │ │ │ │ ├── vulkan_raii.hpp │ │ │ │ ├── vulkan_screen.h │ │ │ │ ├── vulkan_structs.hpp │ │ │ │ ├── vulkan_vi.h │ │ │ │ ├── vulkan_wayland.h │ │ │ │ ├── vulkan_win32.h │ │ │ │ ├── vulkan_xcb.h │ │ │ │ ├── vulkan_xlib.h │ │ │ │ └── vulkan_xlib_xrandr.h │ │ ├── WMMA │ │ │ ├── half.hpp │ │ │ ├── main.cpp │ │ │ ├── premake5.lua │ │ │ └── wmma_test_kernel.h │ │ ├── main.cpp │ │ └── premake5.lua │ ├── UnitTest │ │ ├── README.md │ │ ├── basicTests.cpp │ │ ├── basicTests.h │ │ ├── bitcodes │ │ │ ├── generate_bitcodes.bat │ │ │ ├── generate_bitcodes.sh │ │ │ ├── generate_bitcodes_nvidia.bat │ │ │ └── generate_bitcodes_nvidia.sh │ │ ├── common.cpp │ │ ├── common.h │ │ ├── contrib │ │ │ ├── gtest-1.6.0 │ │ │ │ ├── gtest-all.cc │ │ │ │ └── gtest │ │ │ │ │ ├── gtest-death-test.h │ │ │ │ │ ├── gtest-message.h │ │ │ │ │ ├── gtest-param-test.h │ │ │ │ │ ├── gtest-param-test.h.pump │ │ │ │ │ ├── gtest-printers.h │ │ │ │ │ ├── gtest-spi.h │ │ │ │ │ ├── gtest-test-part.h │ │ │ │ │ ├── gtest-typed-test.h │ │ │ │ │ ├── gtest.h │ │ │ │ │ ├── gtest_pred_impl.h │ │ │ │ │ ├── gtest_prod.h │ │ │ │ │ └── internal │ │ │ │ │ ├── gtest-death-test-internal.h │ │ │ │ │ ├── gtest-filepath.h │ │ │ │ │ ├── gtest-internal.h │ │ │ │ │ ├── gtest-linked_ptr.h │ │ │ │ │ ├── gtest-param-util-generated.h │ │ │ │ │ ├── gtest-param-util-generated.h.pump │ │ │ │ │ ├── gtest-param-util.h │ │ │ │ │ ├── gtest-port.h │ │ │ │ │ ├── gtest-string.h │ │ │ │ │ ├── gtest-tuple.h │ │ │ │ │ ├── gtest-tuple.h.pump │ │ │ │ │ ├── gtest-type-util.h │ │ │ │ │ └── gtest-type-util.h.pump │ │ │ └── stb │ │ │ │ ├── stb_image.cpp │ │ │ │ ├── stb_image.h │ │ │ │ ├── stb_image_write.cpp │ │ │ │ └── stb_image_write.h │ │ ├── demoErrorCodes.h │ │ ├── demosTest.cpp │ │ ├── demosTest.h │ │ ├── main.cpp │ │ ├── moduleTestFunc.cpp │ │ ├── moduleTestFunc.h │ │ ├── moduleTestKernel.cpp │ │ ├── moduleTestKernel.h │ │ ├── moduleTestKernel_loweredName.h │ │ ├── premake5.lua │ │ └── testKernel.h │ ├── contrib │ │ ├── bin │ │ │ └── win64 │ │ │ │ ├── amd_comgr0601.dll │ │ │ │ ├── hiprtc-builtins0601.dll │ │ │ │ └── hiprtc0601.dll │ │ ├── cuew │ │ │ ├── LICENSE.md │ │ │ ├── README.md │ │ │ ├── include │ │ │ │ └── cuew.h │ │ │ └── src │ │ │ │ └── cuew.cpp │ │ └── hipew │ │ │ ├── README.md │ │ │ ├── include │ │ │ └── hipew.h │ │ │ └── src │ │ │ └── hipew.cpp │ ├── premake5.lua │ ├── scripts │ │ ├── convert_binary_to_array.py │ │ ├── enumArch.py │ │ ├── kernelCompile.py │ │ ├── unittest.bat │ │ ├── unittest.sh │ │ ├── unittest_gfx1100.bat │ │ ├── unittest_gfx1100.sh │ │ ├── unittest_gfx1102.bat │ │ ├── unittest_gfx1102.sh │ │ ├── unittest_navi1.bat │ │ ├── unittest_navi1.sh │ │ ├── unittest_navi2.bat │ │ ├── unittest_navi2.sh │ │ ├── unittest_vega10.bat │ │ ├── unittest_vega10.sh │ │ ├── unittest_vega20.bat │ │ └── unittest_vega20.sh │ └── tools │ │ ├── bakeKernel.bat │ │ ├── bakeKernel.sh │ │ ├── genArgs.py │ │ ├── premake5 │ │ ├── linux64 │ │ │ └── premake5 │ │ ├── osx │ │ │ └── premake5 │ │ └── win │ │ │ └── premake5.exe │ │ └── stringify.py ├── argparse │ └── argparse.h ├── cpp20 │ └── source_location.h ├── easy-encryption │ ├── .github │ │ └── FUNDING.yml │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── b64.h │ ├── bin │ │ ├── centos7 │ │ │ └── ee64 │ │ ├── linux │ │ │ └── ee64 │ │ ├── macos │ │ │ └── ee64 │ │ └── win │ │ │ └── ee64.exe │ ├── cl.cpp │ ├── encrypt.h │ ├── main.cpp │ ├── main_vigenere.cpp │ ├── premake5.lua │ ├── vigenere.h │ └── wrapper.py ├── embree │ ├── include │ │ └── embree4 │ │ │ ├── rtcore.h │ │ │ ├── rtcore.isph │ │ │ ├── rtcore_buffer.h │ │ │ ├── rtcore_buffer.isph │ │ │ ├── rtcore_builder.h │ │ │ ├── rtcore_common.h │ │ │ ├── rtcore_common.isph │ │ │ ├── rtcore_config.h │ │ │ ├── rtcore_device.h │ │ │ ├── rtcore_device.isph │ │ │ ├── rtcore_geometry.h │ │ │ ├── rtcore_geometry.isph │ │ │ ├── rtcore_quaternion.h │ │ │ ├── rtcore_quaternion.isph │ │ │ ├── rtcore_ray.h │ │ │ ├── rtcore_ray.isph │ │ │ ├── rtcore_scene.h │ │ │ └── rtcore_scene.isph │ ├── linux │ │ ├── libembree4.so │ │ ├── libembree4.so.4 │ │ ├── libtbb.so │ │ ├── libtbb.so.12 │ │ └── libtbb.so.12.10 │ └── win │ │ ├── embree4.dll │ │ ├── embree4.lib │ │ ├── tbb.lib │ │ ├── tbb12.dll │ │ └── tbb12.lib ├── gtest-1.6.0 │ ├── gtest-all.cc │ └── gtest │ │ ├── gtest-death-test.h │ │ ├── gtest-message.h │ │ ├── gtest-param-test.h │ │ ├── gtest-param-test.h.pump │ │ ├── gtest-printers.h │ │ ├── gtest-spi.h │ │ ├── gtest-test-part.h │ │ ├── gtest-typed-test.h │ │ ├── gtest.h │ │ ├── gtest_pred_impl.h │ │ ├── gtest_prod.h │ │ └── internal │ │ ├── gtest-death-test-internal.h │ │ ├── gtest-filepath.h │ │ ├── gtest-internal.h │ │ ├── gtest-linked_ptr.h │ │ ├── gtest-param-util-generated.h │ │ ├── gtest-param-util-generated.h.pump │ │ ├── gtest-param-util.h │ │ ├── gtest-port.h │ │ ├── gtest-string.h │ │ ├── gtest-tuple.h │ │ ├── gtest-tuple.h.pump │ │ ├── gtest-type-util.h │ │ └── gtest-type-util.h.pump └── stbi │ ├── stb_image.h │ └── stbi_image_write.h ├── hiprt ├── cache │ └── empty.h ├── hiprt.h.in ├── hiprt_common.h ├── hiprt_device.h ├── hiprt_libpath.h ├── hiprt_math.h ├── hiprt_types.h ├── hiprt_vec.h ├── hiprtew.h.in └── impl │ ├── Aabb.h │ ├── AabbList.cpp │ ├── AabbList.h │ ├── ApiNodeList.h │ ├── BatchBuilder.cpp │ ├── BatchBuilder.h │ ├── BatchBuilderKernels.h │ ├── BvhBuilderKernels.h │ ├── BvhBuilderUtil.h │ ├── BvhCommon.h │ ├── BvhConfig.h │ ├── BvhImporter.cpp │ ├── BvhImporter.h │ ├── BvhImporterKernels.h │ ├── BvhNode.cpp │ ├── BvhNode.h │ ├── Compiler.cpp │ ├── Compiler.h │ ├── Context.cpp │ ├── Context.h │ ├── Error.cpp │ ├── Error.h │ ├── Geometry.h │ ├── Instance.h │ ├── InstanceList.cpp │ ├── InstanceList.h │ ├── Kernel.cpp │ ├── Kernel.h │ ├── LbvhBuilder.cpp │ ├── LbvhBuilder.h │ ├── LbvhBuilderKernels.h │ ├── Logger.cpp │ ├── Logger.h │ ├── MemoryArena.h │ ├── MortonCode.h │ ├── PlocBuilder.cpp │ ├── PlocBuilder.h │ ├── PlocBuilderKernels.h │ ├── QrDecomposition.h │ ├── Quaternion.h │ ├── RadixSort.cpp │ ├── RadixSort.h │ ├── SbvhBuilder.cpp │ ├── SbvhBuilder.h │ ├── SbvhBuilderKernels.h │ ├── SbvhCommon.h │ ├── Scene.h │ ├── Timer.h │ ├── Transform.h │ ├── Triangle.h │ ├── TriangleMesh.cpp │ ├── TriangleMesh.h │ ├── Utility.cpp │ ├── Utility.h │ ├── hiprt.cpp │ ├── hiprt_device_impl.h │ ├── hiprt_kernels.h │ └── hiprt_kernels_bitcode.h ├── license.txt ├── premake5.lua ├── scripts ├── bitcodes │ ├── common_tools.py │ ├── compile.py │ └── precompile_bitcode.py ├── concatVersion.py ├── unittest.bat ├── unittest.sh ├── unittest_perf.bat ├── unittest_perf.sh └── unittest_precomp.bat ├── test ├── CornellBox.h ├── bitcodes │ ├── custom_func_table.cpp │ └── unit_test.cpp ├── common │ ├── allocator.h │ ├── bvhbuilder.h │ ├── meshes │ │ └── cornellbox │ │ │ ├── cornellBox.mtl │ │ │ └── cornellBox.obj │ └── tiny_obj_loader.h ├── hiprtTest.cpp ├── hiprtTest.h ├── hiprtewTest.cpp ├── hiprtewTest.h ├── kernels │ ├── AoRayKernel.h │ ├── HiprtTestKernel.h │ ├── PrimaryRayKernel.h │ └── ShadowRayKernel.h ├── main.cpp ├── references │ ├── AoRayBistro.png │ ├── AoRayCornellBox.png │ ├── AoRayHairball.png │ ├── BvhBalancedBistro.png │ ├── BvhBalancedCornellBox.png │ ├── BvhFastBistro.png │ ├── BvhFastCornellBox.png │ ├── BvhHighQBistro.png │ ├── BvhHighQCornellBox.png │ ├── BvhIoApi.png │ ├── BvhUpdateCornellBox.png │ ├── CustomBvhImport.png │ ├── CustomIntersection.png │ ├── Cutout.png │ ├── HitDistCornellBox.png │ ├── MeshIntersection.png │ ├── MinimumCornellBox.png │ ├── MotionBlur.png │ ├── MotionBlurSlerp.png │ ├── NormalsCornellBox.png │ ├── PairTriangles.png │ ├── PrimIdsCornellBox.png │ ├── PrimaryRayBistro.png │ ├── PrimaryRayCornellBox.png │ ├── RayMaskCornellBox.png │ ├── Rebuild0.png │ ├── Rebuild1.png │ ├── RotateCornellBox.png │ ├── ScaleCornellBox.png │ ├── SceneIntersection.png │ ├── SceneIntersectionMlas.png │ ├── SceneIntersectionSingleton.png │ ├── ShadowRayCornellBox.png │ ├── Shear.png │ ├── TranslateCornellBox.png │ ├── Update0.png │ ├── Update1.png │ └── UvsCornellBox.png └── shared.h ├── tools ├── bakeKernel.bat ├── bakeKernel.sh ├── genArgs.py ├── premake5 │ ├── linux64 │ │ └── premake5 │ ├── osx │ │ └── premake5 │ └── win │ │ └── premake5.exe └── stringify.py └── version.txt /.clang-format: -------------------------------------------------------------------------------- 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: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/workflows/format.yaml: -------------------------------------------------------------------------------- 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/clang-format-lint-action@v0.15 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/add-and-commit@v9.1.1 26 | with: 27 | author_name: rprbuild 28 | author_email: a1rpr@amd.com 29 | message: 'Automatic: Committing clang-format changes' 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 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 16 | PUBLIC_OUT/ 17 | hiprt/impl/bvh_build_array.h 18 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/.gitmodules -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2.5.cfa5e2a 2 | - More flexible vector types 3 | - Unifying math into a single header 4 | - Collapse crash fix 5 | - Other minor fixes 6 | 7 | 2.4.c587aa7 8 | - H-PLOC and improved wide BVH conversion 9 | - CMake support 10 | - Configurable HIPRT path via a env. variable 11 | - New gfx architectures supported 12 | - hiprtBuildTraceKernel can return only the HIP module 13 | - HIP module caching and unloading (fixing a memory leak) 14 | - Fixing matrix inversion and identity check 15 | - Fixing refit and other minor issues 16 | 17 | 2.3.7df94af 18 | - Transformation query API changed/extended 19 | 20 | 2.2.0e68f54 (December 2023) 21 | - Multi-level instancing 22 | - Triangle pairing 23 | - AS Compaction 24 | - Optimized BVH build speed 25 | 26 | 2.1.c202dac (November 2023) 27 | - HIPRT binaries compiled with ROCm 5.7 28 | - A fix for caching trace kernels 29 | - A fix for the custom function table compilation 30 | - A fix for the fast and balanced builders with custom streams 31 | 32 | 2.1.6fc8ff0 (September 2023) 33 | - Dynamic traversal stack assignment 34 | - Batch BVH construction 35 | - Transformation query functions 36 | - Improved BVH construction speed 37 | - Improved RT speed for transformed instances 38 | - Fixed geometry IO API 39 | - Optional trace kernel caching 40 | 41 | 2.0.3a134c7 (May 2023) 42 | - BVH memory optimization 43 | - SBVH speed optimization 44 | - Fixing hiprtBuildTraceKernels 45 | - Dynamic loading via HIPRTEW 46 | - Traversal optimization 47 | 48 | 2.0.0 (February 2023) 49 | - Bitcode and precompilation (527.41 or newer driver is necessary to run on NVIDIA® on Windows®) 50 | - Performance improvement 51 | - Navi3x support 52 | - MI60 and MI200 support 53 | - Traversal hints for better performance 54 | - Concurrent build via streams 55 | - Custom function table 56 | - Intersection filter 57 | - Transformation matrices support 58 | - Multiple templated kernels 59 | - Added ray t min 60 | -------------------------------------------------------------------------------- /contrib/Orochi/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: LLVM 2 | IndentWidth: 4 3 | TabWidth: 4 4 | UseTab: Always 5 | BreakBeforeBraces: Allman 6 | ColumnLimit: 256 7 | AllowShortBlocksOnASingleLine: false 8 | AllowShortIfStatementsOnASingleLine: true 9 | NamespaceIndentation: None 10 | SpacesInParentheses: true 11 | SpaceBeforeParens: Never 12 | SpaceAfterTemplateKeyword: false 13 | AlwaysBreakTemplateDeclarations: Yes 14 | PointerAlignment: Left -------------------------------------------------------------------------------- /contrib/Orochi/.gitattributes: -------------------------------------------------------------------------------- 1 | *.dll filter=lfs diff=lfs merge=lfs -text 2 | -------------------------------------------------------------------------------- /contrib/Orochi/.github/workflows/action.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | on: [push] 3 | jobs: 4 | build-linux: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v3 8 | - name: configure 9 | run: sudo apt-get install python3 10 | - name: chmod 11 | run: chmod +x ./tools/premake5/linux64/premake5 12 | - name: premake 13 | run: ./tools/premake5/linux64/premake5 gmake 14 | - name: make 15 | run: make -j Test 16 | -------------------------------------------------------------------------------- /contrib/Orochi/.gitignore: -------------------------------------------------------------------------------- 1 | **/Makefile 2 | **/obj 3 | **/*.log 4 | /cache 5 | dist/** 6 | !dist/*sh 7 | !dist/resultReference 8 | 9 | *.json 10 | *.filters 11 | *.sdf 12 | *.bc 13 | *.o 14 | 15 | !Resources/** 16 | *.vcxproj 17 | *.user 18 | *.sln 19 | *.opendb 20 | *.def 21 | .DS_Store 22 | .vs/ 23 | build/ 24 | 25 | result.xml 26 | UnitTest/bitcodes/*.fatbin 27 | Test/SimpleD3D12/cache/** 28 | 29 | ParallelPrimitives/cache/KernelArgs.h 30 | ParallelPrimitives/cache/Kernels.h 31 | ParallelPrimitives/cache/oro_compiled_kernels.h 32 | -------------------------------------------------------------------------------- /contrib/Orochi/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Advanced Micro Devices, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /contrib/Orochi/ParallelPrimitives/RadixSortConfigs.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2021-2024 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #pragma once 24 | 25 | namespace Oro 26 | { 27 | constexpr auto WG_SIZE{ 64 }; 28 | constexpr auto N_RADIX{ 8 }; 29 | constexpr auto BIN_SIZE{ 1 << N_RADIX }; 30 | constexpr auto RADIX_MASK{ ( 1 << N_RADIX ) - 1 }; 31 | constexpr auto PACK_FACTOR{ sizeof( int ) / sizeof( char ) }; 32 | constexpr auto N_PACKED{ BIN_SIZE / PACK_FACTOR }; 33 | constexpr auto PACK_MAX{ 255 }; 34 | constexpr auto N_PACKED_PER_WI{ N_PACKED / WG_SIZE }; 35 | constexpr auto N_BINS_PER_WI{ BIN_SIZE / WG_SIZE }; 36 | constexpr auto N_BINS_4BIT{ 16 }; 37 | constexpr auto N_BINS_PACK_FACTOR{ sizeof( long long ) / sizeof( short ) }; 38 | constexpr auto N_BINS_PACKED_4BIT{ N_BINS_4BIT / N_BINS_PACK_FACTOR }; 39 | 40 | constexpr auto N_BINS_8BIT{ 1 << 8 }; 41 | 42 | constexpr auto DEFAULT_WARP_SIZE{ 32 }; 43 | 44 | constexpr auto DEFAULT_NUM_WARPS_PER_BLOCK{ 8 }; 45 | 46 | // count config 47 | 48 | constexpr auto DEFAULT_COUNT_BLOCK_SIZE{ DEFAULT_WARP_SIZE * DEFAULT_NUM_WARPS_PER_BLOCK }; 49 | 50 | // scan configs 51 | constexpr auto DEFAULT_SCAN_BLOCK_SIZE{ DEFAULT_WARP_SIZE * DEFAULT_NUM_WARPS_PER_BLOCK }; 52 | 53 | // sort configs 54 | constexpr auto DEFAULT_SORT_BLOCK_SIZE{ DEFAULT_WARP_SIZE * DEFAULT_NUM_WARPS_PER_BLOCK }; 55 | constexpr auto SORT_N_ITEMS_PER_WI{ 12 }; 56 | constexpr auto SINGLE_SORT_N_ITEMS_PER_WI{ 24 }; 57 | constexpr auto SINGLE_SORT_WG_SIZE{ 128 }; 58 | 59 | // Checks 60 | 61 | static_assert( BIN_SIZE % 2 == 0 ); 62 | 63 | // Notice that, on some GPUs, the max size of a GPU block cannot be greater than 256 64 | static_assert( DEFAULT_COUNT_BLOCK_SIZE % DEFAULT_WARP_SIZE == 0 ); 65 | static_assert( DEFAULT_SCAN_BLOCK_SIZE % DEFAULT_WARP_SIZE == 0 ); 66 | 67 | }; // namespace Oro -------------------------------------------------------------------------------- /contrib/Orochi/ParallelPrimitives/cache/empty.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/Orochi/ParallelPrimitives/cache/empty.txt -------------------------------------------------------------------------------- /contrib/Orochi/Test/Common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | inline 10 | oroApi getApiType( int argc, char** argv ) 11 | { 12 | // By default, the 2 API are enabled, and will be automatically selected by Orochi depending on the devices. 13 | oroApi api = ( oroApi )( ORO_API_CUDA | ORO_API_HIP ); 14 | 15 | if( argc >= 2 ) 16 | { 17 | if( strcmp( argv[1], "hip" ) == 0 ) 18 | api = ORO_API_HIP; 19 | if( strcmp( argv[1], "cuda" ) == 0 ) 20 | api = ORO_API_CUDA; 21 | } 22 | return api; 23 | } 24 | 25 | // return true if error 26 | inline bool checkError( oroError e ) 27 | { 28 | if( e != oroSuccess ) 29 | { 30 | const char* pStr = nullptr; 31 | oroGetErrorString( e, &pStr ); 32 | printf("ERROR==================\n"); 33 | if ( pStr ) 34 | printf("%s\n", pStr); 35 | else 36 | printf("\n"); 37 | return true; 38 | } 39 | return false; 40 | } 41 | 42 | // return true if error 43 | inline bool checkError( orortcResult e ) 44 | { 45 | if ( e != ORORTC_SUCCESS ) 46 | { 47 | printf("ERROR in RTC==================\n"); 48 | return true; 49 | } 50 | return false; 51 | } 52 | 53 | #define ERROR_CHECK( e ) if( checkError(e) ) testErrorFlag=true; 54 | 55 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/DeviceEnum/premake5.lua: -------------------------------------------------------------------------------- 1 | project "DeviceEnum" 2 | kind "ConsoleApp" 3 | 4 | targetdir "../../dist/bin/%{cfg.buildcfg}" 5 | location "../../build/" 6 | 7 | if os.istarget("windows") then 8 | links{ "version" } 9 | end 10 | 11 | includedirs { "../../" } 12 | files { "../../Orochi/Orochi.h", "../../Orochi/Orochi.cpp" } 13 | files { "../../contrib/**.h", "../../contrib/**.cpp" } 14 | files { "*.cpp" } 15 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/RadixSort/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## References 3 | 4 | - Single-pass Parallel Prefix Scan with Decoupled Look-back, [PDF](https://research.nvidia.com/publication/single-pass-parallel-prefix-scan-decoupled-look-back) 5 | - StreamScan: Fast Scan Algorithms for GPUs without Global Barrier Synchronization, [PDF](https://docs.google.com/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnxzaGVuZ2VueWFufGd4OjQ3MjhiOTU3NGRhY2ZlYzA) 6 | - A FASTER RADIX SORT IMPLEMENTATION, [PDF](https://developer.download.nvidia.com/video/gputechconf/gtc/2020/presentations/s21572-a-faster-radix-sort-implementation.pdf) 7 | - better to check the detail 8 | - High Performance and Scalable Radix Sorting: a Case Study of Implementing Dynamic Parallelism for GPU Computing, [Archive](https://code.google.com/archive/p/back40computing/) 9 | - Introduction to GPU Radix Sort, [PDF](http://www.heterogeneouscompute.org/wordpress/wp-content/uploads/2011/06/RadixSort.pdf) 10 | - intro 11 | 12 | 13 | ## Other Resources 14 | - FidelityFX sort (Radix sort in DX), [web](https://gpuopen.com/fidelityfx-parallel-sort/) 15 | - Takahiro worked with Jason for this while ago. based on my old sort in OCL. 4 bit per pass, using wave intrinsics. 16 | - A radix sort based on old CUB used in HIPRT 17 | - https://github.com/Radeon-Pro/HIPRT/tree/master/hiprt/impl/radix_sort 18 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/RadixSort/premake5.lua: -------------------------------------------------------------------------------- 1 | project "RadixSort" 2 | kind "ConsoleApp" 3 | 4 | targetdir "../../dist/bin/%{cfg.buildcfg}" 5 | location "../../build/" 6 | 7 | if os.istarget("windows") then 8 | links{ "version" } 9 | end 10 | 11 | includedirs { "../../" } 12 | files { "../../Orochi/**.h", "../../Orochi/**.cpp" } 13 | files { "../../contrib/**.h", "../../contrib/**.cpp" } 14 | files { "*.cpp" } 15 | files { "../../ParallelPrimitives/**.h", "../../ParallelPrimitives/**.cpp" } 16 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/SimpleD3D12/Main.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions 5 | * are met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * * Neither the name of NVIDIA CORPORATION nor the names of its 12 | * contributors may be used to endorse or promote products derived 13 | * from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #include "stdafx.h" 29 | #include "simpleD3D12.h" 30 | 31 | _Use_decl_annotations_ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, 32 | int nCmdShow) { 33 | DX12OroInterop sample(1280, 720, "D3D12 CUDA Interop"); 34 | return Win32Application::Run(&sample, hInstance, nCmdShow); 35 | } 36 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/SimpleD3D12/ShaderStructs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions 5 | * are met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * * Neither the name of NVIDIA CORPORATION nor the names of its 12 | * contributors may be used to endorse or promote products derived 13 | * from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | using namespace DirectX; 36 | 37 | struct Vertex { 38 | XMFLOAT3 position; 39 | XMFLOAT4 color; 40 | }; 41 | 42 | 43 | void RunSineWaveKernel(size_t mesh_width, size_t mesh_height, 44 | Vertex *cudaDevVertptr, oroStream streamToRun, 45 | float AnimTime); -------------------------------------------------------------------------------- /contrib/Orochi/Test/SimpleD3D12/premake5.lua: -------------------------------------------------------------------------------- 1 | project "simpleD3D12" 2 | kind "WindowedApp" 3 | 4 | targetdir "../../dist/bin/%{cfg.buildcfg}" 5 | location "../../build/" 6 | debugdir "." 7 | 8 | buildoptions { "/wd4244" } 9 | defines { "GTEST_HAS_TR1_TUPLE=0" } 10 | -- links{ "Pop" } 11 | libdirs{"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/x64/"} 12 | links{"d3d12", "d3dcompiler", "dxgi", "kernel32", "user32", "gdi32", "winspool", "comdlg32", "advapi32", "shell32", "ole32", "oleaut32", "uuid", "odbc32", "odbccp32", "Version"} 13 | includedirs { "../../" } 14 | includedirs { "./" } 15 | 16 | files {"../../contrib/cuew/src/cuew.cpp" } 17 | 18 | files {"../../contrib/hipew/src/hipew.cpp" } 19 | files {"DX12OroSample.cpp" } 20 | files {"Main.cpp" } 21 | files {"../../Orochi/Orochi.cpp" } 22 | files {"../../Orochi/OrochiUtils.cpp" } 23 | files {"Win32Application.cpp" } 24 | files {"simpleD3D12.cpp" } 25 | files {"stdafx.cpp" } 26 | files {"../../contrib/cuew/include/cuew.h" } 27 | 28 | files {"../../contrib/hipew/include/hipew.h" } 29 | files {"DX12OroSample.h" } 30 | files {"DXSampleHelper.h" } 31 | files {"helper_string.h" } 32 | files {"../../Orochi/Orochi.h" } 33 | files {"../../Orochi/OrochiUtils.h" } 34 | files {"ShaderStructs.h" } 35 | files {"Win32Application.h" } 36 | files {"d3dx12.h" } 37 | --files {"shaders.hlsl" } 38 | files {"simpleD3D12.h" } 39 | files {"stdafx.h" } 40 | files{"sinewave_Orochi.oro"} 41 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/SimpleD3D12/shaders.hlsl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions 5 | * are met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * * Neither the name of NVIDIA CORPORATION nor the names of its 12 | * contributors may be used to endorse or promote products derived 13 | * from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | 29 | 30 | struct PSInput 31 | { 32 | float4 position : SV_POSITION; 33 | float4 color : COLOR; 34 | }; 35 | 36 | PSInput VSMain(float3 position : POSITION, float4 color : COLOR) 37 | { 38 | PSInput result; 39 | 40 | result.position = float4(position, 1.0f); 41 | 42 | // Pass the color through without modification. 43 | result.color = color; 44 | 45 | return result; 46 | } 47 | 48 | float4 PSMain(PSInput input) : SV_TARGET 49 | { 50 | return input.color; 51 | } 52 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/SimpleD3D12/sinewave_Orochi.oro: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions 5 | * are met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * * Neither the name of NVIDIA CORPORATION nor the names of its 12 | * contributors may be used to endorse or promote products derived 13 | * from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | /* 28 | #include 29 | #include 30 | #include 31 | #include 32 | using namespace DirectX; 33 | */ 34 | 35 | struct XMFLOAT3 36 | { 37 | float x; 38 | float y; 39 | float z; 40 | }; 41 | 42 | struct XMFLOAT4 43 | { 44 | float x; 45 | float y; 46 | float z; 47 | float w; 48 | }; 49 | 50 | struct Vertex { 51 | XMFLOAT3 position; 52 | XMFLOAT4 color; 53 | }; 54 | 55 | extern "C" __global__ void sinewave_gen_kernel(Vertex *vertices, unsigned int width, 56 | unsigned int height, float time) { 57 | unsigned int x = blockIdx.x * blockDim.x + threadIdx.x; 58 | unsigned int y = blockIdx.y * blockDim.y + threadIdx.y; 59 | 60 | // calculate uv coordinates 61 | float u = x / (float)width; 62 | float v = y / (float)height; 63 | u = u * 2.0f - 1.0f; 64 | v = v * 2.0f - 1.0f; 65 | 66 | // calculate simple sine wave pattern 67 | float freq = 4.0f; 68 | float w = sinf(u * freq + time) * cosf(v * freq + time) * 0.5f; 69 | 70 | if (y < height && x < width) { 71 | // write output vertex 72 | vertices[y * width + x].position.x = u; 73 | vertices[y * width + x].position.y = w; 74 | vertices[y * width + x].position.z = v; 75 | // vertices[y*width+x].position[3] = 1.0f; 76 | vertices[y * width + x].color.x = 1.0f; 77 | vertices[y * width + x].color.y = 0.0f; 78 | vertices[y * width + x].color.z = 0.0f; 79 | vertices[y * width + x].color.w = 0.0f; 80 | } 81 | } -------------------------------------------------------------------------------- /contrib/Orochi/Test/SimpleD3D12/stdafx.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions 5 | * are met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * * Neither the name of NVIDIA CORPORATION nor the names of its 12 | * contributors may be used to endorse or promote products derived 13 | * from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #include "stdafx.h" 29 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/SimpleD3D12/stdafx.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions 5 | * are met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * * Neither the name of NVIDIA CORPORATION nor the names of its 12 | * contributors may be used to endorse or promote products derived 13 | * from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | // stdafx.h : include file for standard system include files, 29 | // or project specific include files that are used frequently, but 30 | // are changed infrequently. 31 | 32 | #pragma once 33 | 34 | #ifndef WIN32_LEAN_AND_MEAN 35 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers. 36 | #endif 37 | 38 | #include 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include "d3dx12.h" 45 | 46 | #include 47 | #include 48 | #include 49 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/Stopwatch.h: -------------------------------------------------------------------------------- 1 | /* 2 | AMD copyrights (Copyright (c) 2011 Advanced Micro Devices, Inc. All rights reserved) 3 | */ 4 | #pragma once 5 | 6 | #if defined(__WINDOWS__) 7 | #define NOMINMAX 8 | #include 9 | 10 | #define TIME_TYPE LARGE_INTEGER 11 | #define QUERY_FREQ(f) QueryPerformanceFrequency(&f) 12 | #define RECORD(t) QueryPerformanceCounter(&t) 13 | #define GET_TIME(t) (t).QuadPart*1000.0 14 | #define GET_FREQ(f) (f).QuadPart 15 | #else 16 | #include 17 | 18 | #define TIME_TYPE timeval 19 | #define QUERY_FREQ(f) f.tv_sec = 1 20 | #define RECORD(t) gettimeofday(&t, 0) 21 | #define GET_TIME(t) ((t).tv_sec*1000.0+(t).tv_usec/1000.0) 22 | #define GET_FREQ(f) 1.0 23 | #endif 24 | 25 | 26 | class Stopwatch 27 | { 28 | public: 29 | __inline 30 | Stopwatch(); 31 | __inline 32 | void init(); 33 | __inline 34 | void start(); 35 | __inline 36 | void split(); 37 | __inline 38 | float getCurrent(); 39 | __inline 40 | void stop(); 41 | __inline 42 | float getMs(); 43 | __inline 44 | void getMs( float* times, int capacity ); 45 | 46 | private: 47 | enum 48 | { 49 | CAPACITY = 12, 50 | }; 51 | int m_idx; 52 | 53 | TIME_TYPE m_frequency; 54 | TIME_TYPE m_t[CAPACITY]; 55 | }; 56 | 57 | __inline 58 | Stopwatch::Stopwatch() 59 | { 60 | // QueryPerformanceFrequency( &m_frequency ); 61 | QUERY_FREQ( m_frequency ); 62 | } 63 | 64 | __inline 65 | void Stopwatch::start() 66 | { 67 | m_idx = 0; 68 | // QueryPerformanceCounter(&m_t[m_idx++]); 69 | RECORD( m_t[m_idx++] ); 70 | } 71 | 72 | __inline 73 | void Stopwatch::split() 74 | { 75 | // QueryPerformanceCounter(&m_t[m_idx++]); 76 | RECORD( m_t[m_idx++] ); 77 | } 78 | 79 | __inline 80 | float Stopwatch::getCurrent() 81 | { 82 | TIME_TYPE t; 83 | RECORD( t ); 84 | return (float)( GET_TIME(t) - GET_TIME(m_t[0]) )/GET_FREQ(m_frequency); 85 | } 86 | 87 | __inline 88 | void Stopwatch::stop() 89 | { 90 | split(); 91 | } 92 | 93 | __inline 94 | float Stopwatch::getMs() 95 | { 96 | // return (float)(1000*(m_t[1].QuadPart - m_t[0].QuadPart))/m_frequency.QuadPart; 97 | return (float)( GET_TIME( m_t[1] ) - GET_TIME( m_t[0] ) )/GET_FREQ( m_frequency ); 98 | } 99 | 100 | __inline 101 | void Stopwatch::getMs(float* times, int capacity) 102 | { 103 | for(int i=0; i 25 | 26 | 27 | // 28 | // simple code to slightly modify the pixels of an input texture, and output the result into a surface. 29 | // 30 | extern "C" __global__ void texture_test( 31 | oroTextureObject_t texObj, 32 | oroSurfaceObject_t surfObj, 33 | int width, 34 | int height 35 | ) 36 | { 37 | int x = blockIdx.x * blockDim.x + threadIdx.x; 38 | int y = blockIdx.y * blockDim.y + threadIdx.y; 39 | 40 | if (x < width && y < height) 41 | { 42 | uchar4 dataOut; 43 | 44 | float4 dataIn = tex2D(texObj, x, y); 45 | 46 | dataOut.x = min((int)(dataIn.x*255.0f + 40.0f), 255); 47 | dataOut.y = max((int)(dataIn.y*255.0f - 40.0f), 0); 48 | dataOut.z = max((int)(dataIn.z*255.0f - 40.0f), 0); 49 | dataOut.w = 255; 50 | 51 | surf2Dwrite(dataOut, surfObj, x * sizeof(uchar4), y); 52 | } 53 | 54 | return; 55 | } 56 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/README.adoc: -------------------------------------------------------------------------------- 1 | ---- 2 | clang-format -i main.cpp main.comp ; glslangValidator --target-env vulkan1.2 -V main.comp -o main.comp.spv ; spirv-opt -O main.comp.spv -o main.comp.spv ; clang main.cpp ../../Orochi/Orochi.cpp ../../contrib/cuew/src/cuew.cpp ../../contrib/hipew/src/hipew.cpp -I./ -I../../ -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lversion -std=c++17 3 | ---- -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/main.comp: -------------------------------------------------------------------------------- 1 | #version 460 core 2 | #extension GL_GOOGLE_include_directive : enable 3 | #extension GL_EXT_nonuniform_qualifier : enable 4 | #extension GL_EXT_scalar_block_layout : enable 5 | #extension GL_EXT_shader_explicit_arithmetic_types_int8 : require 6 | #extension GL_EXT_shader_explicit_arithmetic_types_int64 : require 7 | #extension GL_EXT_buffer_reference2 : require 8 | 9 | layout(set = 0, binding = 0, scalar) buffer Data { float data[]; }; 10 | 11 | layout(local_size_x = 8) in; 12 | 13 | void main() { data[gl_GlobalInvocationID.x] = float(gl_GlobalInvocationID.x); } -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/main.comp.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/Orochi/Test/VulkanComputeSimple/main.comp.spv -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/premake5.lua: -------------------------------------------------------------------------------- 1 | project "VulkanComputeSimple" 2 | kind "ConsoleApp" 3 | 4 | targetdir "../../dist/bin/%{cfg.buildcfg}" 5 | location "../../build/" 6 | 7 | buildoptions { "/wd4244" } 8 | 9 | -- links{ "Pop" } 10 | links{ "kernel32", "user32", "gdi32", "winspool", "comdlg32", "advapi32", "shell32", "ole32", "oleaut32", "uuid", "odbc32", "odbccp32", "version" } 11 | 12 | includedirs { "../../" } 13 | includedirs { "./" } 14 | files { "../../Orochi/Orochi.h", "../../Orochi/Orochi.cpp" } 15 | files { "*.cpp" } 16 | files { "../../contrib/**.h", "../../contrib/**.cpp" } 17 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vk_video/vulkan_video_codec_h265std_decode.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 2 | #define VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define vulkan_video_codec_h265std_decode 1 23 | #define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8 24 | typedef struct StdVideoDecodeH265PictureInfoFlags { 25 | uint32_t IrapPicFlag : 1; 26 | uint32_t IdrPicFlag : 1; 27 | uint32_t IsReference : 1; 28 | uint32_t short_term_ref_pic_set_sps_flag : 1; 29 | } StdVideoDecodeH265PictureInfoFlags; 30 | 31 | typedef struct StdVideoDecodeH265PictureInfo { 32 | uint8_t vps_video_parameter_set_id; 33 | uint8_t sps_seq_parameter_set_id; 34 | uint8_t pps_pic_parameter_set_id; 35 | uint8_t num_short_term_ref_pic_sets; 36 | int32_t PicOrderCntVal; 37 | uint16_t NumBitsForSTRefPicSetInSlice; 38 | uint8_t NumDeltaPocsOfRefRpsIdx; 39 | uint8_t RefPicSetStCurrBefore[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; 40 | uint8_t RefPicSetStCurrAfter[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; 41 | uint8_t RefPicSetLtCurr[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; 42 | StdVideoDecodeH265PictureInfoFlags flags; 43 | } StdVideoDecodeH265PictureInfo; 44 | 45 | typedef struct StdVideoDecodeH265ReferenceInfoFlags { 46 | uint32_t is_long_term : 1; 47 | uint32_t is_non_existing : 1; 48 | } StdVideoDecodeH265ReferenceInfoFlags; 49 | 50 | typedef struct StdVideoDecodeH265ReferenceInfo { 51 | int32_t PicOrderCntVal; 52 | StdVideoDecodeH265ReferenceInfoFlags flags; 53 | } StdVideoDecodeH265ReferenceInfo; 54 | 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vk_video/vulkan_video_codecs_common.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VIDEO_CODECS_COMMON_H_ 2 | #define VULKAN_VIDEO_CODECS_COMMON_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define vulkan_video_codecs_common 1 23 | #define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \ 24 | ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) 25 | 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vk_platform.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_platform.h 3 | // 4 | /* 5 | ** Copyright 2014-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | 11 | #ifndef VK_PLATFORM_H_ 12 | #define VK_PLATFORM_H_ 13 | 14 | #ifdef __cplusplus 15 | extern "C" 16 | { 17 | #endif // __cplusplus 18 | 19 | /* 20 | *************************************************************************************************** 21 | * Platform-specific directives and type declarations 22 | *************************************************************************************************** 23 | */ 24 | 25 | /* Platform-specific calling convention macros. 26 | * 27 | * Platforms should define these so that Vulkan clients call Vulkan commands 28 | * with the same calling conventions that the Vulkan implementation expects. 29 | * 30 | * VKAPI_ATTR - Placed before the return type in function declarations. 31 | * Useful for C++11 and GCC/Clang-style function attribute syntax. 32 | * VKAPI_CALL - Placed after the return type in function declarations. 33 | * Useful for MSVC-style calling convention syntax. 34 | * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. 35 | * 36 | * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); 37 | * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); 38 | */ 39 | #if defined(_WIN32) 40 | // On Windows, Vulkan commands use the stdcall convention 41 | #define VKAPI_ATTR 42 | #define VKAPI_CALL __stdcall 43 | #define VKAPI_PTR VKAPI_CALL 44 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 45 | #error "Vulkan is not supported for the 'armeabi' NDK ABI" 46 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) 47 | // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" 48 | // calling convention, i.e. float parameters are passed in registers. This 49 | // is true even if the rest of the application passes floats on the stack, 50 | // as it does by default when compiling for the armeabi-v7a NDK ABI. 51 | #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) 52 | #define VKAPI_CALL 53 | #define VKAPI_PTR VKAPI_ATTR 54 | #else 55 | // On other platforms, use the default calling convention 56 | #define VKAPI_ATTR 57 | #define VKAPI_CALL 58 | #define VKAPI_PTR 59 | #endif 60 | 61 | #if !defined(VK_NO_STDDEF_H) 62 | #include 63 | #endif // !defined(VK_NO_STDDEF_H) 64 | 65 | #if !defined(VK_NO_STDINT_H) 66 | #if defined(_MSC_VER) && (_MSC_VER < 1600) 67 | typedef signed __int8 int8_t; 68 | typedef unsigned __int8 uint8_t; 69 | typedef signed __int16 int16_t; 70 | typedef unsigned __int16 uint16_t; 71 | typedef signed __int32 int32_t; 72 | typedef unsigned __int32 uint32_t; 73 | typedef signed __int64 int64_t; 74 | typedef unsigned __int64 uint64_t; 75 | #else 76 | #include 77 | #endif 78 | #endif // !defined(VK_NO_STDINT_H) 79 | 80 | #ifdef __cplusplus 81 | } // extern "C" 82 | #endif // __cplusplus 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vk_sdk_platform.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_sdk_platform.h 3 | // 4 | /* 5 | * Copyright (c) 2015-2016 The Khronos Group Inc. 6 | * Copyright (c) 2015-2016 Valve Corporation 7 | * Copyright (c) 2015-2016 LunarG, Inc. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #ifndef VK_SDK_PLATFORM_H 23 | #define VK_SDK_PLATFORM_H 24 | 25 | #if defined(_WIN32) 26 | #define NOMINMAX 27 | #ifndef __cplusplus 28 | #undef inline 29 | #define inline __inline 30 | #endif // __cplusplus 31 | 32 | #if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) 33 | // C99: 34 | // Microsoft didn't implement C99 in Visual Studio; but started adding it with 35 | // VS2013. However, VS2013 still didn't have snprintf(). The following is a 36 | // work-around (Note: The _CRT_SECURE_NO_WARNINGS macro must be set in the 37 | // "CMakeLists.txt" file). 38 | // NOTE: This is fixed in Visual Studio 2015. 39 | #define snprintf _snprintf 40 | #endif 41 | 42 | #define strdup _strdup 43 | 44 | #endif // _WIN32 45 | 46 | // Check for noexcept support using clang, with fallback to Windows or GCC version numbers 47 | #ifndef NOEXCEPT 48 | #if defined(__clang__) 49 | #if __has_feature(cxx_noexcept) 50 | #define HAS_NOEXCEPT 51 | #endif 52 | #else 53 | #if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46 54 | #define HAS_NOEXCEPT 55 | #else 56 | #if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026 && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS 57 | #define HAS_NOEXCEPT 58 | #endif 59 | #endif 60 | #endif 61 | 62 | #ifdef HAS_NOEXCEPT 63 | #define NOEXCEPT noexcept 64 | #else 65 | #define NOEXCEPT 66 | #endif 67 | #endif 68 | 69 | #endif // VK_SDK_PLATFORM_H 70 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vulkan.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_H_ 2 | #define VULKAN_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | #include "vk_platform.h" 11 | #include "vulkan_core.h" 12 | 13 | #ifdef VK_USE_PLATFORM_ANDROID_KHR 14 | #include "vulkan_android.h" 15 | #endif 16 | 17 | #ifdef VK_USE_PLATFORM_FUCHSIA 18 | #include 19 | #include "vulkan_fuchsia.h" 20 | #endif 21 | 22 | #ifdef VK_USE_PLATFORM_IOS_MVK 23 | #include "vulkan_ios.h" 24 | #endif 25 | 26 | 27 | #ifdef VK_USE_PLATFORM_MACOS_MVK 28 | #include "vulkan_macos.h" 29 | #endif 30 | 31 | #ifdef VK_USE_PLATFORM_METAL_EXT 32 | #include "vulkan_metal.h" 33 | #endif 34 | 35 | #ifdef VK_USE_PLATFORM_VI_NN 36 | #include "vulkan_vi.h" 37 | #endif 38 | 39 | 40 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 41 | #include 42 | #include "vulkan_wayland.h" 43 | #endif 44 | 45 | 46 | #ifdef VK_USE_PLATFORM_WIN32_KHR 47 | #include 48 | #include "vulkan_win32.h" 49 | #endif 50 | 51 | 52 | #ifdef VK_USE_PLATFORM_XCB_KHR 53 | #include 54 | #include "vulkan_xcb.h" 55 | #endif 56 | 57 | 58 | #ifdef VK_USE_PLATFORM_XLIB_KHR 59 | #include 60 | #include "vulkan_xlib.h" 61 | #endif 62 | 63 | 64 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT 65 | #include 66 | #include "vulkan_directfb.h" 67 | #endif 68 | 69 | 70 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT 71 | #include 72 | #include 73 | #include "vulkan_xlib_xrandr.h" 74 | #endif 75 | 76 | 77 | #ifdef VK_USE_PLATFORM_GGP 78 | #include 79 | #include "vulkan_ggp.h" 80 | #endif 81 | 82 | 83 | #ifdef VK_USE_PLATFORM_SCREEN_QNX 84 | #include 85 | #include "vulkan_screen.h" 86 | #endif 87 | 88 | #ifdef VK_ENABLE_BETA_EXTENSIONS 89 | #include "vulkan_beta.h" 90 | #endif 91 | 92 | #endif // VULKAN_H_ 93 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vulkan_directfb.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_DIRECTFB_H_ 2 | #define VULKAN_DIRECTFB_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_EXT_directfb_surface 1 23 | #define VK_EXT_DIRECTFB_SURFACE_SPEC_VERSION 1 24 | #define VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME "VK_EXT_directfb_surface" 25 | typedef VkFlags VkDirectFBSurfaceCreateFlagsEXT; 26 | typedef struct VkDirectFBSurfaceCreateInfoEXT { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkDirectFBSurfaceCreateFlagsEXT flags; 30 | IDirectFB* dfb; 31 | IDirectFBSurface* surface; 32 | } VkDirectFBSurfaceCreateInfoEXT; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateDirectFBSurfaceEXT)(VkInstance instance, const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, IDirectFB* dfb); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDirectFBSurfaceEXT( 39 | VkInstance instance, 40 | const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceDirectFBPresentationSupportEXT( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | IDirectFB* dfb); 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vulkan_ggp.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_GGP_H_ 2 | #define VULKAN_GGP_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_GGP_stream_descriptor_surface 1 23 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION 1 24 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME "VK_GGP_stream_descriptor_surface" 25 | typedef VkFlags VkStreamDescriptorSurfaceCreateFlagsGGP; 26 | typedef struct VkStreamDescriptorSurfaceCreateInfoGGP { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkStreamDescriptorSurfaceCreateFlagsGGP flags; 30 | GgpStreamDescriptor streamDescriptor; 31 | } VkStreamDescriptorSurfaceCreateInfoGGP; 32 | 33 | typedef VkResult (VKAPI_PTR *PFN_vkCreateStreamDescriptorSurfaceGGP)(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 34 | 35 | #ifndef VK_NO_PROTOTYPES 36 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateStreamDescriptorSurfaceGGP( 37 | VkInstance instance, 38 | const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, 39 | const VkAllocationCallbacks* pAllocator, 40 | VkSurfaceKHR* pSurface); 41 | #endif 42 | 43 | 44 | #define VK_GGP_frame_token 1 45 | #define VK_GGP_FRAME_TOKEN_SPEC_VERSION 1 46 | #define VK_GGP_FRAME_TOKEN_EXTENSION_NAME "VK_GGP_frame_token" 47 | typedef struct VkPresentFrameTokenGGP { 48 | VkStructureType sType; 49 | const void* pNext; 50 | GgpFrameToken frameToken; 51 | } VkPresentFrameTokenGGP; 52 | 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vulkan_ios.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_IOS_H_ 2 | #define VULKAN_IOS_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_MVK_ios_surface 1 23 | #define VK_MVK_IOS_SURFACE_SPEC_VERSION 3 24 | #define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface" 25 | typedef VkFlags VkIOSSurfaceCreateFlagsMVK; 26 | typedef struct VkIOSSurfaceCreateInfoMVK { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkIOSSurfaceCreateFlagsMVK flags; 30 | const void* pView; 31 | } VkIOSSurfaceCreateInfoMVK; 32 | 33 | typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 34 | 35 | #ifndef VK_NO_PROTOTYPES 36 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK( 37 | VkInstance instance, 38 | const VkIOSSurfaceCreateInfoMVK* pCreateInfo, 39 | const VkAllocationCallbacks* pAllocator, 40 | VkSurfaceKHR* pSurface); 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vulkan_macos.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_MACOS_H_ 2 | #define VULKAN_MACOS_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_MVK_macos_surface 1 23 | #define VK_MVK_MACOS_SURFACE_SPEC_VERSION 3 24 | #define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface" 25 | typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; 26 | typedef struct VkMacOSSurfaceCreateInfoMVK { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkMacOSSurfaceCreateFlagsMVK flags; 30 | const void* pView; 31 | } VkMacOSSurfaceCreateInfoMVK; 32 | 33 | typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 34 | 35 | #ifndef VK_NO_PROTOTYPES 36 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK( 37 | VkInstance instance, 38 | const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, 39 | const VkAllocationCallbacks* pAllocator, 40 | VkSurfaceKHR* pSurface); 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vulkan_metal.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_METAL_H_ 2 | #define VULKAN_METAL_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_EXT_metal_surface 1 23 | 24 | #ifdef __OBJC__ 25 | @class CAMetalLayer; 26 | #else 27 | typedef void CAMetalLayer; 28 | #endif 29 | 30 | #define VK_EXT_METAL_SURFACE_SPEC_VERSION 1 31 | #define VK_EXT_METAL_SURFACE_EXTENSION_NAME "VK_EXT_metal_surface" 32 | typedef VkFlags VkMetalSurfaceCreateFlagsEXT; 33 | typedef struct VkMetalSurfaceCreateInfoEXT { 34 | VkStructureType sType; 35 | const void* pNext; 36 | VkMetalSurfaceCreateFlagsEXT flags; 37 | const CAMetalLayer* pLayer; 38 | } VkMetalSurfaceCreateInfoEXT; 39 | 40 | typedef VkResult (VKAPI_PTR *PFN_vkCreateMetalSurfaceEXT)(VkInstance instance, const VkMetalSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 41 | 42 | #ifndef VK_NO_PROTOTYPES 43 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMetalSurfaceEXT( 44 | VkInstance instance, 45 | const VkMetalSurfaceCreateInfoEXT* pCreateInfo, 46 | const VkAllocationCallbacks* pAllocator, 47 | VkSurfaceKHR* pSurface); 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vulkan_screen.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_SCREEN_H_ 2 | #define VULKAN_SCREEN_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_QNX_screen_surface 1 23 | #define VK_QNX_SCREEN_SURFACE_SPEC_VERSION 1 24 | #define VK_QNX_SCREEN_SURFACE_EXTENSION_NAME "VK_QNX_screen_surface" 25 | typedef VkFlags VkScreenSurfaceCreateFlagsQNX; 26 | typedef struct VkScreenSurfaceCreateInfoQNX { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkScreenSurfaceCreateFlagsQNX flags; 30 | struct _screen_context* context; 31 | struct _screen_window* window; 32 | } VkScreenSurfaceCreateInfoQNX; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateScreenSurfaceQNX)(VkInstance instance, const VkScreenSurfaceCreateInfoQNX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct _screen_window* window); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateScreenSurfaceQNX( 39 | VkInstance instance, 40 | const VkScreenSurfaceCreateInfoQNX* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceScreenPresentationSupportQNX( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | struct _screen_window* window); 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vulkan_vi.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VI_H_ 2 | #define VULKAN_VI_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_NN_vi_surface 1 23 | #define VK_NN_VI_SURFACE_SPEC_VERSION 1 24 | #define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface" 25 | typedef VkFlags VkViSurfaceCreateFlagsNN; 26 | typedef struct VkViSurfaceCreateInfoNN { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkViSurfaceCreateFlagsNN flags; 30 | void* window; 31 | } VkViSurfaceCreateInfoNN; 32 | 33 | typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 34 | 35 | #ifndef VK_NO_PROTOTYPES 36 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN( 37 | VkInstance instance, 38 | const VkViSurfaceCreateInfoNN* pCreateInfo, 39 | const VkAllocationCallbacks* pAllocator, 40 | VkSurfaceKHR* pSurface); 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vulkan_wayland.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_WAYLAND_H_ 2 | #define VULKAN_WAYLAND_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_KHR_wayland_surface 1 23 | #define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6 24 | #define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface" 25 | typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; 26 | typedef struct VkWaylandSurfaceCreateInfoKHR { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkWaylandSurfaceCreateFlagsKHR flags; 30 | struct wl_display* display; 31 | struct wl_surface* surface; 32 | } VkWaylandSurfaceCreateInfoKHR; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR( 39 | VkInstance instance, 40 | const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | struct wl_display* display); 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vulkan_xcb.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XCB_H_ 2 | #define VULKAN_XCB_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_KHR_xcb_surface 1 23 | #define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 24 | #define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface" 25 | typedef VkFlags VkXcbSurfaceCreateFlagsKHR; 26 | typedef struct VkXcbSurfaceCreateInfoKHR { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkXcbSurfaceCreateFlagsKHR flags; 30 | xcb_connection_t* connection; 31 | xcb_window_t window; 32 | } VkXcbSurfaceCreateInfoKHR; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR( 39 | VkInstance instance, 40 | const VkXcbSurfaceCreateInfoKHR* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | xcb_connection_t* connection, 48 | xcb_visualid_t visual_id); 49 | #endif 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vulkan_xlib.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XLIB_H_ 2 | #define VULKAN_XLIB_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_KHR_xlib_surface 1 23 | #define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6 24 | #define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface" 25 | typedef VkFlags VkXlibSurfaceCreateFlagsKHR; 26 | typedef struct VkXlibSurfaceCreateInfoKHR { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkXlibSurfaceCreateFlagsKHR flags; 30 | Display* dpy; 31 | Window window; 32 | } VkXlibSurfaceCreateInfoKHR; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR( 39 | VkInstance instance, 40 | const VkXlibSurfaceCreateInfoKHR* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | Display* dpy, 48 | VisualID visualID); 49 | #endif 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/VulkanComputeSimple/vulkan/vulkan_xlib_xrandr.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XLIB_XRANDR_H_ 2 | #define VULKAN_XLIB_XRANDR_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_EXT_acquire_xlib_display 1 23 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1 24 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display" 25 | typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display); 26 | typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay); 27 | 28 | #ifndef VK_NO_PROTOTYPES 29 | VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT( 30 | VkPhysicalDevice physicalDevice, 31 | Display* dpy, 32 | VkDisplayKHR display); 33 | 34 | VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT( 35 | VkPhysicalDevice physicalDevice, 36 | Display* dpy, 37 | RROutput rrOutput, 38 | VkDisplayKHR* pDisplay); 39 | #endif 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/WMMA/premake5.lua: -------------------------------------------------------------------------------- 1 | project "WMMA" 2 | kind "ConsoleApp" 3 | 4 | targetdir "../../dist/bin/%{cfg.buildcfg}" 5 | location "../../build/" 6 | 7 | if os.istarget("windows") then 8 | links{ "version" } 9 | end 10 | 11 | includedirs { "../../" } 12 | files { "../../Orochi/**.h", "../../Orochi/**.cpp" } 13 | files { "../../contrib/**.h", "../../contrib/**.cpp" } 14 | files { "*.h", "*.cpp" } 15 | files { "half.hpp" } 16 | -------------------------------------------------------------------------------- /contrib/Orochi/Test/premake5.lua: -------------------------------------------------------------------------------- 1 | project "SimpleDemo" 2 | kind "ConsoleApp" 3 | 4 | targetdir "../dist/bin/%{cfg.buildcfg}" 5 | location "../build/" 6 | 7 | if os.istarget("windows") then 8 | links{ "version" } 9 | end 10 | includedirs { "../" } 11 | files { "../Orochi/Orochi.h", "../Orochi/Orochi.cpp" } 12 | files { "*.cpp" } 13 | files { "../contrib/**.h", "../contrib/**.cpp" } 14 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/README.md: -------------------------------------------------------------------------------- 1 | To compile the two kernels on navi21: 2 | 3 | `hipcc --offload-arch=gfx1030 moduleTestFunc.cpp -c -fgpu-rdc --cuda-device-only` 4 | `hipcc --offload-arch=gfx1030 moduleTestKernel.cpp -c -fgpu-rdc --cuda-device-only` 5 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/basicTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2021-2024 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #pragma once 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/bitcodes/generate_bitcodes.bat: -------------------------------------------------------------------------------- 1 | call hipcc --cuda-device-only --offload-arch=gfx1030 --offload-arch=gfx1031 --offload-arch=gfx1032 --offload-arch=gfx1033 --offload-arch=gfx1034 --offload-arch=gfx1035 --offload-arch=gfx1036 --offload-arch=gfx1010 --offload-arch=gfx1011 --offload-arch=gfx1012 --offload-arch=gfx1013 --offload-arch=gfx900 --offload-arch=gfx906 -fgpu-rdc -c --gpu-bundle-output -c -emit-llvm ../moduleTestKernel.cpp 2 | call hipcc --cuda-device-only --offload-arch=gfx1030 --offload-arch=gfx1031 --offload-arch=gfx1032 --offload-arch=gfx1033 --offload-arch=gfx1034 --offload-arch=gfx1035 --offload-arch=gfx1036 --offload-arch=gfx1010 --offload-arch=gfx1011 --offload-arch=gfx1012 --offload-arch=gfx1013 --offload-arch=gfx900 --offload-arch=gfx906 -fgpu-rdc -c --gpu-bundle-output -c -emit-llvm ../moduleTestFunc.cpp 3 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/bitcodes/generate_bitcodes.sh: -------------------------------------------------------------------------------- 1 | hipcc --cuda-device-only --offload-arch=gfx1030 --offload-arch=gfx1031 --offload-arch=gfx1032 --offload-arch=gfx1033 --offload-arch=gfx1034 --offload-arch=gfx1035 --offload-arch=gfx1036 --offload-arch=gfx1010 --offload-arch=gfx1011 --offload-arch=gfx1012 --offload-arch=gfx1013 --offload-arch=gfx900 --offload-arch=gfx906 -fgpu-rdc -c --gpu-bundle-output -c -emit-llvm ../moduleTestKernel.cpp 2 | hipcc --cuda-device-only --offload-arch=gfx1030 --offload-arch=gfx1031 --offload-arch=gfx1032 --offload-arch=gfx1033 --offload-arch=gfx1034 --offload-arch=gfx1035 --offload-arch=gfx1036 --offload-arch=gfx1010 --offload-arch=gfx1011 --offload-arch=gfx1012 --offload-arch=gfx1013 --offload-arch=gfx900 --offload-arch=gfx906 -fgpu-rdc -c --gpu-bundle-output -c -emit-llvm ../moduleTestFunc.cpp 3 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/bitcodes/generate_bitcodes_nvidia.bat: -------------------------------------------------------------------------------- 1 | nvcc -x cu -fatbin --device-c -arch=all ../moduleTestFunc.cpp 2 | nvcc -x cu -fatbin --device-c -arch=all ../moduleTestKernel.cpp 3 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/bitcodes/generate_bitcodes_nvidia.sh: -------------------------------------------------------------------------------- 1 | nvcc -fatbin --device-c -arch=all ../moduleTestFunc.cu 2 | nvcc -fatbin --device-c -arch=all ../moduleTestKernel.cu 3 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/common.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2021-2024 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #include "common.h" 24 | 25 | 26 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/contrib/gtest-1.6.0/gtest/gtest_prod.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Google C++ Testing Framework definitions useful in production code. 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 35 | #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 36 | 37 | // When you need to test the private or protected members of a class, 38 | // use the FRIEND_TEST macro to declare your tests as friends of the 39 | // class. For example: 40 | // 41 | // class MyClass { 42 | // private: 43 | // void MyMethod(); 44 | // FRIEND_TEST(MyClassTest, MyMethod); 45 | // }; 46 | // 47 | // class MyClassTest : public testing::Test { 48 | // // ... 49 | // }; 50 | // 51 | // TEST_F(MyClassTest, MyMethod) { 52 | // // Can call MyClass::MyMethod() here. 53 | // } 54 | 55 | #define FRIEND_TEST(test_case_name, test_name)\ 56 | friend class test_case_name##_##test_name##_Test 57 | 58 | #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 59 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/contrib/stb/stb_image.cpp: -------------------------------------------------------------------------------- 1 | 2 | #ifdef WIN32 3 | #define STBI_WINDOWS_UTF8 4 | #endif 5 | 6 | #define STB_IMAGE_IMPLEMENTATION 7 | #include "stb_image.h" 8 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/contrib/stb/stb_image_write.cpp: -------------------------------------------------------------------------------- 1 | 2 | #ifdef WIN32 3 | #define STBI_WINDOWS_UTF8 4 | #endif 5 | 6 | #define STB_IMAGE_WRITE_IMPLEMENTATION 7 | #include "stb_image_write.h" 8 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/demoErrorCodes.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2021-2024 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #pragma once 24 | 25 | // it's advised to use those error code for the return of the Demos standalones. 26 | // Some Demos are played by the UnitTest program, and those return codes will be checked by it. 27 | // Using a custom code for success ( 100 instead of 0 ) is just to add an additional level of check and confirm that the Demo was fully executed. 28 | const int OROCHI_TEST_RETCODE__SUCCESS = 100; 29 | const int OROCHI_TEST_RETCODE__ERROR = 99; 30 | 31 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/demosTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2021-2024 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #pragma once 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2021-2024 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | 24 | #include "common.h" 25 | 26 | int main( int argc, char* argv[] ) 27 | { 28 | ::testing::InitGoogleTest( &argc, argv ); 29 | int retCode = RUN_ALL_TESTS(); 30 | return retCode; 31 | } 32 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/moduleTestFunc.cpp: -------------------------------------------------------------------------------- 1 | #if !defined( __CUDACC__ ) 2 | #include 3 | #endif 4 | 5 | __device__ void setInfo( int *x ) 6 | { 7 | int tid = threadIdx.x; 8 | atomicAdd( x, tid ); 9 | } 10 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/moduleTestFunc.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2021-2024 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | __device__ void setInfo( int* x ) 24 | { 25 | int tid = threadIdx.x; 26 | atomicAdd( x, tid ); 27 | } -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/moduleTestKernel.cpp: -------------------------------------------------------------------------------- 1 | extern __device__ void setInfo( int *x ); 2 | 3 | extern "C" __global__ void testKernel( int *x ) 4 | { 5 | setInfo(x); 6 | } 7 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/moduleTestKernel.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2021-2024 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | extern __device__ void setInfo( int *x ); 24 | 25 | extern "C" __global__ void testKernel( int *x ) 26 | { 27 | setInfo(x); 28 | } 29 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/moduleTestKernel_loweredName.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2021-2024 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | extern __device__ void setInfo( int *x ); 24 | 25 | template 26 | __global__ void testKernel( int *x ) 27 | { 28 | setInfo(x); 29 | } 30 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/premake5.lua: -------------------------------------------------------------------------------- 1 | project "Unittest" 2 | kind "ConsoleApp" 3 | 4 | targetdir "../dist/bin/%{cfg.buildcfg}" 5 | location "../build/" 6 | 7 | if os.istarget("windows") then 8 | links{ "version" } 9 | end 10 | if os.istarget("linux") then 11 | links { "pthread" } 12 | end 13 | includedirs { "../" } 14 | files { "../Orochi/**.h", "../Orochi/**.cpp" } 15 | files { "*.cpp", "*.h" } 16 | removefiles { "moduleTestFunc.cpp", "moduleTestKernel.cpp" } 17 | files { "../contrib/**.h", "../contrib/**.cpp" } 18 | files { "../UnitTest/contrib/**.h", "../UnitTest/contrib/**.cpp" } 19 | 20 | files { "../UnitTest/contrib/gtest-1.6.0/gtest-all.cc" } 21 | externalincludedirs{ "../UnitTest/contrib/gtest-1.6.0/" } 22 | defines { "GTEST_HAS_TR1_TUPLE=0" } 23 | if _OPTIONS["kernelcompile"] then 24 | os.execute( "cd ./bitcodes/ && generate_bitcodes.bat" ) 25 | os.execute( "cd ./bitcodes/ && generate_bitcodes_nvidia.bat" ) 26 | end 27 | -------------------------------------------------------------------------------- /contrib/Orochi/UnitTest/testKernel.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2021-2024 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | extern "C" __global__ void testKernel( int* __restrict__ a ) 24 | { 25 | int tid = threadIdx.x; 26 | atomicAdd(a, tid); 27 | } 28 | 29 | // function pointer test 30 | 31 | typedef int ( *FuncPointer )( const int idx ); 32 | 33 | __device__ int testFunc( const int idx ) 34 | { 35 | if( idx == 0 ) 36 | return 7; 37 | return 0; 38 | } 39 | 40 | __device__ FuncPointer gFuncPointer = testFunc; 41 | 42 | extern "C" __global__ void testFuncPointerKernel( int* __restrict__ a, FuncPointer* gPointers ) 43 | { 44 | int b = gPointers[0]( threadIdx.x ); 45 | atomicAdd( a, b ); 46 | } 47 | 48 | extern "C" __global__ void streamData(float *ptr, const size_t n, 49 | float* output, const float val) 50 | { 51 | size_t idx = blockIdx.x *blockDim.x + threadIdx.x; 52 | float accum = 0.0f; 53 | 54 | for(; idx < n; idx += 1) 55 | { 56 | accum += ptr[idx]; 57 | } 58 | output[threadIdx.x] = accum; 59 | } -------------------------------------------------------------------------------- /contrib/Orochi/contrib/bin/win64/amd_comgr0601.dll: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:d99d86fe78b719ca2f0502da3f37f5d41ef3f9efa0bc5ebf39c129cc31a9653d 3 | size 110273240 4 | -------------------------------------------------------------------------------- /contrib/Orochi/contrib/bin/win64/hiprtc-builtins0601.dll: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:cc29cf387cf1e1b59826f4ffe21922f849f47378cea3ec2ce00dc2ad38254d95 3 | size 1065688 4 | -------------------------------------------------------------------------------- /contrib/Orochi/contrib/bin/win64/hiprtc0601.dll: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:4ac7b741cf60afc4de24a07f15c3bd2fce5e052e0be8497960b75004a6d2de11 3 | size 1940184 4 | -------------------------------------------------------------------------------- /contrib/Orochi/contrib/cuew/README.md: -------------------------------------------------------------------------------- 1 | The CUDA Extension Wrangler Library (CUEW) is a cross-platform open-source 2 | C/C++ extension loading library. CUEW provides efficient run-time mechanisms 3 | for determining which CUDA functions and extensions extensions are supported 4 | on the target platform. 5 | 6 | CUDA core and extension functionality is exposed in a single header file. 7 | CUEW has been tested on a variety of operating systems, including Windows, 8 | Linux, Mac OS X. 9 | 10 | LICENSE 11 | 12 | CUEW library is released under the Apache 2.0 license. 13 | -------------------------------------------------------------------------------- /contrib/Orochi/contrib/hipew/README.md: -------------------------------------------------------------------------------- 1 | The HIP Extension Wrangler Library (HIPEW) is a cross-platform open-source 2 | C/C++ library to dynamically load the HIP library. 3 | 4 | HIP (Heterogeneous-Compute Interface for Portability) is an API for C++ 5 | programming on AMD GPUs. 6 | 7 | It is maintained as part of the Blender project, but included in extern/ 8 | for consistency with CUEW and CLEW libraries. 9 | 10 | LICENSE 11 | 12 | HIPEW is released under the Apache 2.0 license. 13 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/convert_binary_to_array.py: -------------------------------------------------------------------------------- 1 | # convert_binary_to_header.py 2 | import sys 3 | from pathlib import Path 4 | 5 | def binary_to_c_array(bin_file, array_name): 6 | with open(bin_file, 'rb') as f: 7 | binary_data = f.read() 8 | 9 | hex_array = ', '.join(f'0x{b:02x}' for b in binary_data) 10 | c_array = f'const unsigned char {array_name}[] = {{\n {hex_array}\n}};\n' 11 | c_array += f'const size_t {array_name}_size = sizeof({array_name});\n' 12 | return c_array 13 | 14 | if __name__ == "__main__": 15 | if len(sys.argv) != 3: 16 | print(f"Usage: {sys.argv[0]} ") 17 | sys.exit(1) 18 | 19 | bin_file = sys.argv[1] 20 | header_file_path = sys.argv[2] 21 | header_file = Path(header_file_path).name 22 | array_name = header_file.replace('.', '_') 23 | 24 | c_array = binary_to_c_array(bin_file, array_name) 25 | with open(header_file_path, 'w') as f: 26 | f.write("// generated by convert_binary_to_header.py\n") 27 | f.write(c_array) 28 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/enumArch.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import re 4 | 5 | def toNumber( arch ): 6 | return int(arch[3:], 16) 7 | 8 | def enumArch( minArch ): 9 | process = subprocess.Popen(['llc', '-march=amdgcn', '-mcpu=help'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) 10 | output, errors = process.communicate() 11 | lines = output.decode('utf-8').splitlines() + errors.decode('utf-8').splitlines() 12 | 13 | arches = [] 14 | for line in lines: 15 | result = re.match("\s+(gfx[0-9a-f]+).*processor.", line) 16 | if result: 17 | arch = result.group(1) 18 | if toNumber(minArch) <= toNumber(arch): 19 | arches.append( arch ) 20 | if not arches: 21 | print( "warning: llc may not working" ) 22 | return arches 23 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/kernelCompile.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import subprocess 4 | import re 5 | from enumArch import enumArch 6 | 7 | #for powershell, $ENV:Path+=";..\..\hipsdk\bin" 8 | 9 | def getGpuList(): 10 | f = open("amdGpuList.json") 11 | gpus = json.load(f) 12 | f.close() 13 | return gpus 14 | 15 | ps = [] 16 | def compile( index ): 17 | if index == 0 : 18 | command = [ 19 | "hipcc", 20 | "-x", "hip", "..\ParallelPrimitives\RadixSortKernels.h", "-O3", "-std=c++17", "-ffast-math", "--cuda-device-only", "--genco", "-I../", "-include", "hip/hip_runtime.h", "-parallel-jobs=15"] 21 | #command.append( "--offload-arch=gfx1100" ) 22 | for i in enumArch( "gfx900" ): 23 | command.append( "--offload-arch=" + i ) 24 | command.append( "-o" ) 25 | command.append( "../bitcodes/oro_compiled_kernels.hipfb" ) 26 | else: 27 | command = [ 28 | 'nvcc', '-x','cu','..\ParallelPrimitives\RadixSortKernels.h','-O3', '-std=c++17', '--use_fast_math', '-fatbin', '-arch=all', 29 | '-I../', '-include', 'cuda_runtime.h' ] 30 | command.append( '-o' ) 31 | command.append('../bitcodes/oro_compiled_kernels.fatbin') 32 | 33 | print( " ".join( command ) ) 34 | 35 | if os.name == 'nt': 36 | ps.append( subprocess.Popen( command, shell=True ) ) 37 | else: 38 | ps.append( subprocess.Popen( command ) ) 39 | 40 | compile( 0 ) 41 | compile( 1 ) 42 | 43 | for p in ps: 44 | p.wait() 45 | 46 | print( "compile done." ) -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest.bat: -------------------------------------------------------------------------------- 1 | rd /s /q cache 2 | ..\dist\bin\Release\Unittest64.exe --gtest_filter=-*link_bundledBc* --gtest_output=xml:../result.xml 3 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest.sh: -------------------------------------------------------------------------------- 1 | rm -rf cache 2 | cd ../UnitTest/bitcodes 3 | ./generate_bitcodes.sh 4 | cd ../../scripts 5 | ../dist/bin/Release/Unittest64 --gtest_filter=-*link_bundledBc* --gtest_output=xml:../result.xml 6 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest_gfx1100.bat: -------------------------------------------------------------------------------- 1 | rd /s /q cache 2 | cd ..\UnitTest\bitcodes 3 | call generate_bitcodes_gfx1100.bat 4 | cd ..\..\scripts 5 | ..\dist\bin\Release\Unittest64 --gtest_filter=-*getErrorString* --gtest_output=xml:../result.xml 6 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest_gfx1100.sh: -------------------------------------------------------------------------------- 1 | rm -rf cache 2 | cd ../UnitTest/bitcodes && ./generate_bitcodes_gfx1100.sh 3 | cd ../../scripts 4 | ../dist/bin/Release/Unittest64 --gtest_filter=-*link*:*getErrorString* --gtest_output=xml:../result.xml 5 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest_gfx1102.bat: -------------------------------------------------------------------------------- 1 | rd /s /q cache 2 | cd ..\UnitTest\bitcodes 3 | call generate_bitcodes_gfx1102.bat 4 | cd ..\..\scripts 5 | ..\dist\bin\Release\Unittest64 --gtest_filter=-*getErrorString* --gtest_output=xml:../result.xml 6 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest_gfx1102.sh: -------------------------------------------------------------------------------- 1 | rm -rf cache 2 | cd ../UnitTest/bitcodes && ./generate_bitcodes_gfx1102.sh 3 | cd ../../scripts 4 | ../dist/bin/Release/Unittest64 --gtest_filter=-*link*:*getErrorString* --gtest_output=xml:../result.xml 5 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest_navi1.bat: -------------------------------------------------------------------------------- 1 | rd /s /q cache 2 | ..\dist\bin\Release\Unittest64.exe --gtest_filter=-*getErrorString*:*link_bundledBc_with_bc_loweredName* --gtest_output=xml:../result.xml 3 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest_navi1.sh: -------------------------------------------------------------------------------- 1 | rm -rf cache 2 | cd ../UnitTest/bitcodes && ./generate_bitcodes.sh && cd ../../scripts 3 | ../dist/bin/Release/Unittest64 --gtest_filter=-*link*:*getErrorString* --gtest_output=xml:../result.xml 4 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest_navi2.bat: -------------------------------------------------------------------------------- 1 | rd /s /q cache 2 | ..\dist\bin\Release\Unittest64.exe --gtest_filter=-*getErrorString*:*link_bundledBc_with_bc_loweredName* --gtest_output=xml:../result.xml 3 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest_navi2.sh: -------------------------------------------------------------------------------- 1 | rm -rf cache 2 | cd ../UnitTest/bitcodes && ./generate_bitcodes.sh && cd ../../scripts 3 | ../dist/bin/Release/Unittest64 --gtest_filter=-*link*:*getErrorString* --gtest_output=xml:../result.xml 4 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest_vega10.bat: -------------------------------------------------------------------------------- 1 | rd /s /q cache 2 | ..\dist\bin\Release\Unittest64.exe --gtest_filter=-*getErrorString*:*link_bundledBc_with_bc_loweredName* --gtest_output=xml:../result.xml 3 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest_vega10.sh: -------------------------------------------------------------------------------- 1 | rm -rf cache 2 | cd ../UnitTest/bitcodes && ./generate_bitcodes.sh && cd ../../scripts 3 | ../dist/bin/Release/Unittest64 --gtest_filter=-*link*:*getErrorString* --gtest_output=xml:../result.xml 4 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest_vega20.bat: -------------------------------------------------------------------------------- 1 | rd /s /q cache 2 | ..\dist\bin\Release\Unittest64.exe --gtest_filter=-*getErrorString*:*link_bundledBc_with_bc_loweredName* --gtest_output=xml:../result.xml 3 | -------------------------------------------------------------------------------- /contrib/Orochi/scripts/unittest_vega20.sh: -------------------------------------------------------------------------------- 1 | rm -rf cache 2 | cd ../UnitTest/bitcodes && ./generate_bitcodes.sh && cd ../../scripts 3 | ../dist/bin/Release/Unittest64 --gtest_filter=-*link*:*getErrorString* --gtest_output=xml:../result.xml 4 | -------------------------------------------------------------------------------- /contrib/Orochi/tools/bakeKernel.bat: -------------------------------------------------------------------------------- 1 | echo // automatically generated, don't edit > ParallelPrimitives/cache/Kernels.h 2 | echo // automatically generated, don't edit > ParallelPrimitives/cache/KernelArgs.h 3 | python tools/stringify.py ./ParallelPrimitives/RadixSortKernels.h >> ParallelPrimitives/cache/Kernels.h 4 | python tools/genArgs.py ./ParallelPrimitives/RadixSortKernels.h >> ParallelPrimitives/cache/KernelArgs.h 5 | 6 | python tools/stringify.py ./ParallelPrimitives/RadixSortConfigs.h >> ParallelPrimitives/cache/Kernels.h 7 | -------------------------------------------------------------------------------- /contrib/Orochi/tools/bakeKernel.sh: -------------------------------------------------------------------------------- 1 | # mkdir hiprt/cache/ 2 | echo "// automatically generated, don't edit" > ParallelPrimitives/cache/Kernels.h 3 | echo "// automatically generated, don't edit" > ParallelPrimitives/cache/KernelArgs.h 4 | python tools/stringify.py ./ParallelPrimitives/RadixSortKernels.h >> ParallelPrimitives/cache/Kernels.h 5 | python tools/genArgs.py ./ParallelPrimitives/RadixSortKernels.h >> ParallelPrimitives/cache/KernelArgs.h 6 | 7 | python tools/stringify.py ./ParallelPrimitives/RadixSortConfigs.h >> ParallelPrimitives/cache/Kernels.h 8 | -------------------------------------------------------------------------------- /contrib/Orochi/tools/genArgs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from __future__ import print_function 3 | 4 | import sys 5 | import os 6 | 7 | def genArgs( fileName, api, includes ): 8 | with open(fileName) as f: 9 | iName = os.path.basename( fileName ).split('.')[0] 10 | 11 | print( '#if !defined(ORO_PP_LOAD_FROM_STRING)' ) 12 | print( ' static const char** '+iName+'Args = 0;' ) 13 | print( '#else' ) 14 | print( ' static const char* '+iName+'Args[] = {' ) 15 | includes += iName +'Includes[] = {' 16 | for line in f.readlines(): 17 | a = line.strip('\r\n') 18 | if a.find('#include') == -1: 19 | continue 20 | if a.find('#include') != -1 and a.find('inl.' + api) != -1: 21 | continue 22 | if (api == 'cl' or api == 'metal') and a.find('.cu') != -1: 23 | continue 24 | if (a.find('"') != -1 and a.find('#include') != -1): 25 | continue 26 | 27 | filename = os.path.basename(a.split('<')[1].split('>')[0]) 28 | includes += '"' + a.split('<')[1].split('>')[0] + '",' 29 | name = filename.split('.' + api)[0] 30 | name = name.split('.h')[0] 31 | name = api + '_'+name 32 | print ( name + ',' ) 33 | print( api + '_'+iName+'};' ) 34 | print( '#endif' ) 35 | return includes 36 | 37 | argvs = sys.argv 38 | 39 | files = [] 40 | if len(argvs) >= 2: 41 | files.append( argvs[1] ) 42 | 43 | print( '#pragma once' ) 44 | 45 | 46 | api = 'hip' 47 | 48 | # Visit each file 49 | print( 'namespace ' + api + ' {') 50 | 51 | includes = 'static const char* ' 52 | for s in files: 53 | includes = genArgs(s, api, includes) 54 | includes += '};' 55 | print( includes ) 56 | print( '}\t//namespace ' + api) 57 | -------------------------------------------------------------------------------- /contrib/Orochi/tools/premake5/linux64/premake5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/Orochi/tools/premake5/linux64/premake5 -------------------------------------------------------------------------------- /contrib/Orochi/tools/premake5/osx/premake5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/Orochi/tools/premake5/osx/premake5 -------------------------------------------------------------------------------- /contrib/Orochi/tools/premake5/win/premake5.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/Orochi/tools/premake5/win/premake5.exe -------------------------------------------------------------------------------- /contrib/cpp20/source_location.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2021-2024 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #pragma once 24 | 25 | 26 | #if __cplusplus >= 202002L // if C++20, we can use the default source_location class 27 | 28 | #include 29 | using source_location = std::source_location; 30 | 31 | #else // .. otherwise, we use a custom implementation 32 | 33 | 34 | class source_location 35 | { 36 | public: 37 | constexpr source_location(const char* file = "unknown", const char* function = "unknown", int line = 0, int column = 0) noexcept 38 | : file_(file), function_(function), line_(line), column_(column) {} 39 | 40 | constexpr const char* file_name() const noexcept { return file_; } 41 | constexpr const char* function_name() const noexcept { return function_; } 42 | constexpr int line() const noexcept { return line_; } 43 | constexpr int column() const noexcept { return column_; } 44 | 45 | static constexpr source_location current(const char* file = __builtin_FILE(), const char* function = __builtin_FUNCTION(), int line = __builtin_LINE(), int column = 0) noexcept { 46 | return source_location(file, function, line, column); 47 | } 48 | 49 | private: 50 | const char* file_; 51 | const char* function_; 52 | int line_; 53 | int column_; 54 | }; 55 | 56 | 57 | #endif 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /contrib/easy-encryption/.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [philipperemy] 2 | -------------------------------------------------------------------------------- /contrib/easy-encryption/.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | a.out 35 | -------------------------------------------------------------------------------- /contrib/easy-encryption/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Philippe Rémy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /contrib/easy-encryption/b64.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | 9 | static std::string base64_encode(const std::string &in) { 10 | 11 | std::string out; 12 | 13 | int val=0, valb=-6; 14 | for (int jj = 0; jj < in.size(); jj++) { 15 | char c = in[jj]; 16 | val = (val<<8) + c; 17 | valb += 8; 18 | while (valb>=0) { 19 | out.push_back("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(val>>valb)&0x3F]); 20 | valb-=6; 21 | } 22 | } 23 | if (valb>-6) out.push_back("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[((val<<8)>>(valb+8))&0x3F]); 24 | while (out.size()%4) out.push_back('='); 25 | return out; 26 | } 27 | 28 | static std::string base64_decode(const std::string &in) { 29 | 30 | std::string out; 31 | 32 | std::vector T(256,-1); 33 | for (int i=0; i<64; i++) T["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[i]] = i; 34 | 35 | int val=0, valb=-8; 36 | for (int jj = 0; jj < in.size(); jj++) { 37 | char c = in[jj]; 38 | if (T[c] == -1) break; 39 | val = (val<<6) + T[c]; 40 | valb += 6; 41 | if (valb>=0) { 42 | out.push_back(char((val>>valb)&0xFF)); 43 | valb-=8; 44 | } 45 | } 46 | return out; 47 | } 48 | -------------------------------------------------------------------------------- /contrib/easy-encryption/bin/centos7/ee64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/easy-encryption/bin/centos7/ee64 -------------------------------------------------------------------------------- /contrib/easy-encryption/bin/linux/ee64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/easy-encryption/bin/linux/ee64 -------------------------------------------------------------------------------- /contrib/easy-encryption/bin/macos/ee64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/easy-encryption/bin/macos/ee64 -------------------------------------------------------------------------------- /contrib/easy-encryption/bin/win/ee64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/easy-encryption/bin/win/ee64.exe -------------------------------------------------------------------------------- /contrib/easy-encryption/cl.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "encrypt.h" 9 | 10 | using namespace std; 11 | 12 | string load( const char* path ) 13 | { 14 | FILE* src = fopen(path, "rb"); 15 | string res; 16 | 17 | fseek(src,0,SEEK_END); 18 | int size = ftell(src); 19 | rewind( src ); 20 | res.resize(size); 21 | fread(const_cast(res.data()), size, 1, src); 22 | fclose(src); 23 | return res; 24 | } 25 | 26 | void write( const char* path, string& str ) 27 | { 28 | # if 1 29 | FILE* fp = fopen( path, "wb" ); 30 | fwrite( str.c_str(), strlen( str.c_str() ), 1, fp ); 31 | fclose( fp ); 32 | #else 33 | ofstream ofs(path); 34 | ofs << str; 35 | ofs.close(); 36 | #endif 37 | } 38 | 39 | int main(int argc, char** argv) 40 | { 41 | //ee64 src.txt dst.txt key 0 42 | #if 1 43 | std::string key = argv[3]; 44 | int encrypt_flag = atoi(argv[4]); 45 | 46 | string src = load( argv[1] ); 47 | string dst; 48 | if(encrypt_flag == 0) { 49 | dst = encrypt(src, key); 50 | } else { 51 | dst = decrypt(src, key); 52 | } 53 | 54 | write( argv[2], dst ); 55 | #else 56 | std::string msg = argv[1]; 57 | std::string key = argv[2]; 58 | int encrypt_flag = atoi(argv[3]); 59 | 60 | if(encrypt_flag == 0) { 61 | std::cout << encrypt(msg, key) << std::endl; 62 | } else { 63 | std::cout << decrypt(msg, key) << std::endl; 64 | } 65 | #endif 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /contrib/easy-encryption/encrypt.h: -------------------------------------------------------------------------------- 1 | #include "b64.h" 2 | #include "vigenere.h" 3 | 4 | std::string encrypt(std::string& msg, std::string& key) { 5 | std::string b64_str = base64_encode(msg); 6 | std::string vigenere_msg = encrypt_vigenere(b64_str, key); 7 | // std::cout << vigenere_msg << std::endl; 8 | return vigenere_msg; 9 | } 10 | 11 | 12 | std::string decrypt(std::string& encrypted_msg, std::string& key) { 13 | std::string newKey = extend_key(encrypted_msg, key); 14 | std::string b64_encoded_str = decrypt_vigenere(encrypted_msg, newKey); 15 | std::string b64_decode_str = base64_decode(b64_encoded_str); 16 | return b64_decode_str; 17 | } -------------------------------------------------------------------------------- /contrib/easy-encryption/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "encrypt.h" 8 | 9 | using namespace std; 10 | 11 | int main() { 12 | // std::string msg = "HELLO WORLD"; 13 | std::string msg = "{\"id\":1,\"method\":\"service.subscribe\",\"params\":[\"myapp/0.1c\", null,\"0.0.0.0\",\"80\"]}"; 14 | std::string key = "THISISMYKEY"; 15 | std::cout << " message to send: " << msg << std::endl; 16 | std::string encrypted_msg = encrypt(msg, key); 17 | std::cout << "encrypted message: " << encrypted_msg << std::endl; 18 | std::string decrypted_msg = decrypt(encrypted_msg, key); 19 | std::cout << "decrypted message: " << decrypted_msg << std::endl; 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /contrib/easy-encryption/main_vigenere.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "vigenere.h" 8 | #include "b64.h" 9 | 10 | using namespace std; 11 | 12 | int main() { 13 | 14 | // Vigenere encoding 15 | 16 | std::string msg = "HELLO WORLD"; 17 | std::string key = "THISISALONGPRIVATEKEY"; 18 | std::string encryptedMsg = encrypt_vigenere(msg, key); 19 | std::string newKey = extend_key(msg, key); 20 | std::string decryptedMsg = decrypt_vigenere(encryptedMsg, newKey); 21 | 22 | std::cout << "Original Message : " << msg << std::endl; 23 | std::cout << "Key : " << key << std::endl; 24 | std::cout << "New Generated Key: " << newKey << std::endl; 25 | std::cout << "Enc Vigenere Msg : " << encryptedMsg << std::endl; 26 | std::cout << "Dec Vigenere Msg : " << decryptedMsg << std::endl; 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /contrib/easy-encryption/premake5.lua: -------------------------------------------------------------------------------- 1 | workspace "ee" 2 | configurations { "Debug", "Release" } 3 | language "C++" 4 | platforms "x64" 5 | architecture "x86_64" 6 | 7 | project "ee" 8 | kind "ConsoleApp" 9 | 10 | targetdir "dist/bin/%{cfg.buildcfg}" 11 | location "build/" 12 | 13 | sysincludedirs { "./" } 14 | 15 | files { "cl.cpp" } 16 | 17 | filter {"platforms:x64", "configurations:Debug"} 18 | targetsuffix "64D" 19 | defines { "DEBUG" } 20 | symbols "On" 21 | 22 | filter {"platforms:x64", "configurations:Release"} 23 | targetsuffix "64" 24 | defines { "NDEBUG" } 25 | optimize "On" 26 | -------------------------------------------------------------------------------- /contrib/easy-encryption/vigenere.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | std::string AVAILABLE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 "; 11 | 12 | int index(char c) { 13 | for(int ii = 0; ii < AVAILABLE_CHARS.size(); ii++) { 14 | if(AVAILABLE_CHARS[ii] == c) { 15 | // std::cout << ii << " " << c << std::endl; 16 | return ii; 17 | } 18 | } 19 | return -1; 20 | } 21 | 22 | 23 | std::string extend_key(std::string& msg, std::string& key) { 24 | //generating new key 25 | int msgLen = static_cast( msg.size() ); 26 | std::string newKey(msgLen, 'x'); 27 | int keyLen = static_cast( key.size() ), i, j; 28 | for(i = 0, j = 0; i < msgLen; ++i, ++j){ 29 | if(j == keyLen) 30 | j = 0; 31 | 32 | newKey[i] = key[j]; 33 | } 34 | newKey[i] = '\0'; 35 | return newKey; 36 | } 37 | 38 | 39 | std::string encrypt_vigenere(std::string& msg, std::string& key) { 40 | int msgLen = static_cast( msg.size() ), keyLen = static_cast( key.size() ), i; 41 | std::string encryptedMsg(msgLen, 'x'); 42 | // char newKey[msgLen], encryptedMsg[msgLen], decryptedMsg[msgLen]; 43 | 44 | std::string newKey = extend_key(msg, key); 45 | 46 | //encryption 47 | for(i = 0; i < msgLen; ++i) { 48 | // std::cout << msg[i] << " " << isalnum(msg[i]) << std::endl; 49 | if(isalnum(msg[i]) || msg[i] == ' ') { 50 | encryptedMsg[i] = AVAILABLE_CHARS[((index(msg[i]) + index(newKey[i])) % AVAILABLE_CHARS.size())]; 51 | } else { 52 | encryptedMsg[i] = msg[i]; 53 | } 54 | } 55 | 56 | encryptedMsg[i] = '\0'; 57 | return encryptedMsg; 58 | } 59 | 60 | std::string decrypt_vigenere(std::string& encryptedMsg, std::string& newKey) { 61 | // decryption 62 | int msgLen = static_cast( encryptedMsg.size() ); 63 | std::string decryptedMsg(msgLen, 'x'); 64 | int i; 65 | for(i = 0; i < msgLen; ++i) { 66 | if(isalnum(encryptedMsg[i]) || encryptedMsg[i] == ' ') { 67 | decryptedMsg[i] = AVAILABLE_CHARS[(((index(encryptedMsg[i]) - index(newKey[i])) + AVAILABLE_CHARS.size()) % AVAILABLE_CHARS.size())]; 68 | } else { 69 | decryptedMsg[i] = encryptedMsg[i]; 70 | } 71 | } 72 | decryptedMsg[i] = '\0'; 73 | return decryptedMsg; 74 | } 75 | 76 | -------------------------------------------------------------------------------- /contrib/easy-encryption/wrapper.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | 4 | def decrypt(message, key): 5 | return subprocess.check_output(['./a.out', message, key, "1"]).decode('utf8').strip() 6 | 7 | 8 | def encrypt(message, key): 9 | return subprocess.check_output(['./a.out', message, key, "0"]).decode('utf8').strip() 10 | 11 | 12 | if __name__ == '__main__': 13 | original_msg = 'Hello world' 14 | key = 'key123' 15 | encrypted_msg = encrypt(original_msg, key) 16 | print('ORIGINAL : ' + original_msg) 17 | print('ENCRYPTED : ' + encrypted_msg) 18 | print('DECRYPTED : ' + decrypt(encrypted_msg, key)) 19 | -------------------------------------------------------------------------------- /contrib/embree/include/embree4/rtcore.h: -------------------------------------------------------------------------------- 1 | // Copyright 2009-2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "rtcore_config.h" 7 | #include "rtcore_common.h" 8 | #include "rtcore_device.h" 9 | #include "rtcore_buffer.h" 10 | #include "rtcore_ray.h" 11 | #include "rtcore_geometry.h" 12 | #include "rtcore_scene.h" 13 | #include "rtcore_builder.h" 14 | #include "rtcore_quaternion.h" 15 | -------------------------------------------------------------------------------- /contrib/embree/include/embree4/rtcore.isph: -------------------------------------------------------------------------------- 1 | // Copyright 2009-2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #ifndef __RTC_ISPH__ 5 | #define __RTC_ISPH__ 6 | 7 | #include "rtcore_config.h" 8 | #include "rtcore_common.isph" 9 | #include "rtcore_device.isph" 10 | #include "rtcore_buffer.isph" 11 | #include "rtcore_ray.isph" 12 | #include "rtcore_geometry.isph" 13 | #include "rtcore_scene.isph" 14 | #include "rtcore_quaternion.isph" 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /contrib/embree/include/embree4/rtcore_buffer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2009-2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "rtcore_device.h" 7 | 8 | RTC_NAMESPACE_BEGIN 9 | 10 | /* Types of buffers */ 11 | enum RTCBufferType 12 | { 13 | RTC_BUFFER_TYPE_INDEX = 0, 14 | RTC_BUFFER_TYPE_VERTEX = 1, 15 | RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE = 2, 16 | RTC_BUFFER_TYPE_NORMAL = 3, 17 | RTC_BUFFER_TYPE_TANGENT = 4, 18 | RTC_BUFFER_TYPE_NORMAL_DERIVATIVE = 5, 19 | 20 | RTC_BUFFER_TYPE_GRID = 8, 21 | 22 | RTC_BUFFER_TYPE_FACE = 16, 23 | RTC_BUFFER_TYPE_LEVEL = 17, 24 | RTC_BUFFER_TYPE_EDGE_CREASE_INDEX = 18, 25 | RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT = 19, 26 | RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX = 20, 27 | RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT = 21, 28 | RTC_BUFFER_TYPE_HOLE = 22, 29 | 30 | RTC_BUFFER_TYPE_TRANSFORM = 23, 31 | 32 | RTC_BUFFER_TYPE_FLAGS = 32 33 | }; 34 | 35 | /* Opaque buffer type */ 36 | typedef struct RTCBufferTy* RTCBuffer; 37 | 38 | /* Creates a new buffer. */ 39 | RTC_API RTCBuffer rtcNewBuffer(RTCDevice device, size_t byteSize); 40 | 41 | /* Creates a new shared buffer. */ 42 | RTC_API RTCBuffer rtcNewSharedBuffer(RTCDevice device, void* ptr, size_t byteSize); 43 | 44 | /* Returns a pointer to the buffer data. */ 45 | RTC_API void* rtcGetBufferData(RTCBuffer buffer); 46 | 47 | /* Retains the buffer (increments the reference count). */ 48 | RTC_API void rtcRetainBuffer(RTCBuffer buffer); 49 | 50 | /* Releases the buffer (decrements the reference count). */ 51 | RTC_API void rtcReleaseBuffer(RTCBuffer buffer); 52 | 53 | RTC_NAMESPACE_END 54 | -------------------------------------------------------------------------------- /contrib/embree/include/embree4/rtcore_buffer.isph: -------------------------------------------------------------------------------- 1 | // Copyright 2009-2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #ifndef __RTC_BUFFER_ISPH__ 5 | #define __RTC_BUFFER_ISPH__ 6 | 7 | #include "rtcore_device.isph" 8 | 9 | /* Types of buffers */ 10 | enum RTCBufferType 11 | { 12 | RTC_BUFFER_TYPE_INDEX = 0, 13 | RTC_BUFFER_TYPE_VERTEX = 1, 14 | RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE = 2, 15 | RTC_BUFFER_TYPE_NORMAL = 3, 16 | RTC_BUFFER_TYPE_TANGENT = 4, 17 | RTC_BUFFER_TYPE_NORMAL_DERIVATIVE = 5, 18 | 19 | RTC_BUFFER_TYPE_GRID = 8, 20 | 21 | RTC_BUFFER_TYPE_FACE = 16, 22 | RTC_BUFFER_TYPE_LEVEL = 17, 23 | RTC_BUFFER_TYPE_EDGE_CREASE_INDEX = 18, 24 | RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT = 19, 25 | RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX = 20, 26 | RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT = 21, 27 | RTC_BUFFER_TYPE_HOLE = 22, 28 | 29 | RTC_BUFFER_TYPE_TRANSFORM = 23, 30 | 31 | RTC_BUFFER_TYPE_FLAGS = 32 32 | }; 33 | 34 | /* Opaque buffer type */ 35 | typedef uniform struct RTCBufferTy* uniform RTCBuffer; 36 | 37 | /* Creates a new buffer. */ 38 | RTC_API RTCBuffer rtcNewBuffer(RTCDevice device, uniform uintptr_t byteSize); 39 | 40 | /* Creates a new shared buffer. */ 41 | RTC_API RTCBuffer rtcNewSharedBuffer(RTCDevice device, void* uniform ptr, uniform uintptr_t byteSize); 42 | 43 | /* Returns a pointer to the buffer data. */ 44 | RTC_API void* uniform rtcGetBufferData(RTCBuffer buffer); 45 | 46 | /* Retains the buffer (increments the reference count). */ 47 | RTC_API void rtcRetainBuffer(RTCBuffer buffer); 48 | 49 | /* Releases the buffer handle (decrements the reference count). */ 50 | RTC_API void rtcReleaseBuffer(RTCBuffer buffer); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /contrib/embree/include/embree4/rtcore_config.h: -------------------------------------------------------------------------------- 1 | // Copyright 2009-2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #if !defined(EMBREE_SYCL_SUPPORT) 7 | /* #undef EMBREE_SYCL_SUPPORT */ 8 | #endif 9 | 10 | #define RTC_VERSION_MAJOR 4 11 | #define RTC_VERSION_MINOR 3 12 | #define RTC_VERSION_PATCH 0 13 | #define RTC_VERSION 40300 14 | #define RTC_VERSION_STRING "4.3.0" 15 | 16 | #define RTC_MAX_INSTANCE_LEVEL_COUNT 1 17 | 18 | #define EMBREE_GEOMETRY_INSTANCE_ARRAY 19 | #if defined(EMBREE_GEOMETRY_INSTANCE_ARRAY) 20 | #define RTC_GEOMETRY_INSTANCE_ARRAY 21 | #endif 22 | 23 | #define EMBREE_SYCL_GEOMETRY_CALLBACK 0 24 | 25 | #define EMBREE_MIN_WIDTH 0 26 | #define RTC_MIN_WIDTH EMBREE_MIN_WIDTH 27 | 28 | #if !defined(EMBREE_STATIC_LIB) 29 | /* #undef EMBREE_STATIC_LIB */ 30 | #endif 31 | /* #undef EMBREE_API_NAMESPACE */ 32 | 33 | #if defined(EMBREE_API_NAMESPACE) 34 | # define RTC_NAMESPACE 35 | # define RTC_NAMESPACE_BEGIN namespace { 36 | # define RTC_NAMESPACE_END } 37 | # define RTC_NAMESPACE_USE using namespace ; 38 | # define RTC_API_EXTERN_C 39 | # undef EMBREE_API_NAMESPACE 40 | #else 41 | # define RTC_NAMESPACE_BEGIN 42 | # define RTC_NAMESPACE_END 43 | # define RTC_NAMESPACE_USE 44 | # if defined(__cplusplus) 45 | # define RTC_API_EXTERN_C extern "C" 46 | # else 47 | # define RTC_API_EXTERN_C 48 | # endif 49 | #endif 50 | 51 | #if defined(ISPC) 52 | # define RTC_API_IMPORT extern "C" unmasked 53 | # define RTC_API_EXPORT extern "C" unmasked 54 | #elif defined(EMBREE_STATIC_LIB) 55 | # define RTC_API_IMPORT RTC_API_EXTERN_C 56 | # define RTC_API_EXPORT RTC_API_EXTERN_C 57 | #elif defined(_WIN32) 58 | # define RTC_API_IMPORT RTC_API_EXTERN_C __declspec(dllimport) 59 | # define RTC_API_EXPORT RTC_API_EXTERN_C __declspec(dllexport) 60 | #else 61 | # define RTC_API_IMPORT RTC_API_EXTERN_C 62 | # define RTC_API_EXPORT RTC_API_EXTERN_C __attribute__ ((visibility ("default"))) 63 | #endif 64 | 65 | #if defined(RTC_EXPORT_API) 66 | # define RTC_API RTC_API_EXPORT 67 | #else 68 | # define RTC_API RTC_API_IMPORT 69 | #endif 70 | 71 | #if defined(ISPC) 72 | # define RTC_SYCL_INDIRECTLY_CALLABLE 73 | #elif defined(__SYCL_DEVICE_ONLY__) 74 | # define RTC_SYCL_INDIRECTLY_CALLABLE [[intel::device_indirectly_callable]] SYCL_EXTERNAL 75 | # define RTC_SYCL_API SYCL_EXTERNAL 76 | #else 77 | # define RTC_SYCL_INDIRECTLY_CALLABLE 78 | # define RTC_SYCL_API RTC_API 79 | #endif 80 | 81 | -------------------------------------------------------------------------------- /contrib/embree/include/embree4/rtcore_device.isph: -------------------------------------------------------------------------------- 1 | // Copyright 2009-2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #ifndef __RTC_DEVICE_ISPH__ 5 | #define __RTC_DEVICE_ISPH__ 6 | 7 | #include "rtcore_common.isph" 8 | 9 | /* Opaque device type */ 10 | typedef uniform struct RTCDeviceTy* uniform RTCDevice; 11 | 12 | /* Creates a new Embree device. */ 13 | RTC_API RTCDevice rtcNewDevice(const uniform int8* uniform config); 14 | 15 | /* Retains the Embree device (increments the reference count). */ 16 | RTC_API void rtcRetainDevice(RTCDevice device); 17 | 18 | /* Releases an Embree device (decrements the reference count). */ 19 | RTC_API void rtcReleaseDevice(RTCDevice device); 20 | 21 | /* Device properties */ 22 | enum RTCDeviceProperty 23 | { 24 | RTC_DEVICE_PROPERTY_VERSION = 0, 25 | RTC_DEVICE_PROPERTY_VERSION_MAJOR = 1, 26 | RTC_DEVICE_PROPERTY_VERSION_MINOR = 2, 27 | RTC_DEVICE_PROPERTY_VERSION_PATCH = 3, 28 | 29 | RTC_DEVICE_PROPERTY_NATIVE_RAY4_SUPPORTED = 32, 30 | RTC_DEVICE_PROPERTY_NATIVE_RAY8_SUPPORTED = 33, 31 | RTC_DEVICE_PROPERTY_NATIVE_RAY16_SUPPORTED = 34, 32 | 33 | RTC_DEVICE_PROPERTY_BACKFACE_CULLING_CURVES_ENABLED = 63, 34 | RTC_DEVICE_PROPERTY_RAY_MASK_SUPPORTED = 64, 35 | RTC_DEVICE_PROPERTY_BACKFACE_CULLING_ENABLED = 65, 36 | RTC_DEVICE_PROPERTY_FILTER_FUNCTION_SUPPORTED = 66, 37 | RTC_DEVICE_PROPERTY_IGNORE_INVALID_RAYS_ENABLED = 67, 38 | RTC_DEVICE_PROPERTY_COMPACT_POLYS_ENABLED = 68, 39 | 40 | RTC_DEVICE_PROPERTY_TRIANGLE_GEOMETRY_SUPPORTED = 96, 41 | RTC_DEVICE_PROPERTY_QUAD_GEOMETRY_SUPPORTED = 97, 42 | RTC_DEVICE_PROPERTY_SUBDIVISION_GEOMETRY_SUPPORTED = 98, 43 | RTC_DEVICE_PROPERTY_CURVE_GEOMETRY_SUPPORTED = 99, 44 | RTC_DEVICE_PROPERTY_USER_GEOMETRY_SUPPORTED = 100, 45 | 46 | RTC_DEVICE_PROPERTY_TASKING_SYSTEM = 128, 47 | RTC_DEVICE_PROPERTY_JOIN_COMMIT_SUPPORTED = 129, 48 | RTC_DEVICE_PROPERTY_PARALLEL_COMMIT_SUPPORTED = 130 49 | }; 50 | 51 | /* Gets a device property. */ 52 | RTC_API uniform intptr_t rtcGetDeviceProperty(RTCDevice device, uniform RTCDeviceProperty prop); 53 | 54 | /* Sets a device property. */ 55 | RTC_API void rtcSetDeviceProperty(RTCDevice device, const uniform RTCDeviceProperty prop, uniform intptr_t value); 56 | 57 | /* Error codes */ 58 | enum RTCError 59 | { 60 | RTC_ERROR_NONE = 0, 61 | RTC_ERROR_UNKNOWN = 1, 62 | RTC_ERROR_INVALID_ARGUMENT = 2, 63 | RTC_ERROR_INVALID_OPERATION = 3, 64 | RTC_ERROR_OUT_OF_MEMORY = 4, 65 | RTC_ERROR_UNSUPPORTED_CPU = 5, 66 | RTC_ERROR_CANCELLED = 6 67 | }; 68 | 69 | /* Returns the error code. */ 70 | RTC_API uniform RTCError rtcGetDeviceError(RTCDevice device); 71 | 72 | /* Error callback function */ 73 | typedef unmasked void (*uniform RTCErrorFunction)(void* uniform userPtr, uniform RTCError code, const uniform int8* uniform str); 74 | 75 | /* Sets the error callback function. */ 76 | RTC_API void rtcSetDeviceErrorFunction(RTCDevice device, uniform RTCErrorFunction error, void* uniform userPtr); 77 | 78 | /* Memory monitor callback function */ 79 | typedef unmasked uniform bool (*uniform RTCMemoryMonitorFunction)(void* uniform ptr, uniform intptr_t bytes, uniform bool post); 80 | 81 | /* Sets the memory monitor callback function. */ 82 | RTC_API void rtcSetDeviceMemoryMonitorFunction(RTCDevice device, RTCMemoryMonitorFunction memoryMonitor, void* uniform userPtr); 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /contrib/embree/include/embree4/rtcore_quaternion.h: -------------------------------------------------------------------------------- 1 | // Copyright 2009-2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "rtcore_common.h" 7 | 8 | RTC_NAMESPACE_BEGIN 9 | 10 | /* 11 | * Structure for transformation representation as a matrix decomposition using 12 | * a quaternion 13 | */ 14 | struct RTC_ALIGN(16) RTCQuaternionDecomposition 15 | { 16 | float scale_x; 17 | float scale_y; 18 | float scale_z; 19 | float skew_xy; 20 | float skew_xz; 21 | float skew_yz; 22 | float shift_x; 23 | float shift_y; 24 | float shift_z; 25 | float quaternion_r; 26 | float quaternion_i; 27 | float quaternion_j; 28 | float quaternion_k; 29 | float translation_x; 30 | float translation_y; 31 | float translation_z; 32 | }; 33 | 34 | RTC_FORCEINLINE void rtcInitQuaternionDecomposition(struct RTCQuaternionDecomposition* qdecomp) 35 | { 36 | qdecomp->scale_x = 1.f; 37 | qdecomp->scale_y = 1.f; 38 | qdecomp->scale_z = 1.f; 39 | qdecomp->skew_xy = 0.f; 40 | qdecomp->skew_xz = 0.f; 41 | qdecomp->skew_yz = 0.f; 42 | qdecomp->shift_x = 0.f; 43 | qdecomp->shift_y = 0.f; 44 | qdecomp->shift_z = 0.f; 45 | qdecomp->quaternion_r = 1.f; 46 | qdecomp->quaternion_i = 0.f; 47 | qdecomp->quaternion_j = 0.f; 48 | qdecomp->quaternion_k = 0.f; 49 | qdecomp->translation_x = 0.f; 50 | qdecomp->translation_y = 0.f; 51 | qdecomp->translation_z = 0.f; 52 | } 53 | 54 | RTC_FORCEINLINE void rtcQuaternionDecompositionSetQuaternion( 55 | struct RTCQuaternionDecomposition* qdecomp, 56 | float r, float i, float j, float k) 57 | { 58 | qdecomp->quaternion_r = r; 59 | qdecomp->quaternion_i = i; 60 | qdecomp->quaternion_j = j; 61 | qdecomp->quaternion_k = k; 62 | } 63 | 64 | RTC_FORCEINLINE void rtcQuaternionDecompositionSetScale( 65 | struct RTCQuaternionDecomposition* qdecomp, 66 | float scale_x, float scale_y, float scale_z) 67 | { 68 | qdecomp->scale_x = scale_x; 69 | qdecomp->scale_y = scale_y; 70 | qdecomp->scale_z = scale_z; 71 | } 72 | 73 | RTC_FORCEINLINE void rtcQuaternionDecompositionSetSkew( 74 | struct RTCQuaternionDecomposition* qdecomp, 75 | float skew_xy, float skew_xz, float skew_yz) 76 | { 77 | qdecomp->skew_xy = skew_xy; 78 | qdecomp->skew_xz = skew_xz; 79 | qdecomp->skew_yz = skew_yz; 80 | } 81 | 82 | RTC_FORCEINLINE void rtcQuaternionDecompositionSetShift( 83 | struct RTCQuaternionDecomposition* qdecomp, 84 | float shift_x, float shift_y, float shift_z) 85 | { 86 | qdecomp->shift_x = shift_x; 87 | qdecomp->shift_y = shift_y; 88 | qdecomp->shift_z = shift_z; 89 | } 90 | 91 | RTC_FORCEINLINE void rtcQuaternionDecompositionSetTranslation( 92 | struct RTCQuaternionDecomposition* qdecomp, 93 | float translation_x, float translation_y, float translation_z) 94 | { 95 | qdecomp->translation_x = translation_x; 96 | qdecomp->translation_y = translation_y; 97 | qdecomp->translation_z = translation_z; 98 | } 99 | 100 | RTC_NAMESPACE_END 101 | 102 | -------------------------------------------------------------------------------- /contrib/embree/linux/libembree4.so: -------------------------------------------------------------------------------- 1 | libembree4.so.4 -------------------------------------------------------------------------------- /contrib/embree/linux/libembree4.so.4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/embree/linux/libembree4.so.4 -------------------------------------------------------------------------------- /contrib/embree/linux/libtbb.so: -------------------------------------------------------------------------------- 1 | libtbb.so.12 -------------------------------------------------------------------------------- /contrib/embree/linux/libtbb.so.12: -------------------------------------------------------------------------------- 1 | libtbb.so.12.10 -------------------------------------------------------------------------------- /contrib/embree/linux/libtbb.so.12.10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/embree/linux/libtbb.so.12.10 -------------------------------------------------------------------------------- /contrib/embree/win/embree4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/embree/win/embree4.dll -------------------------------------------------------------------------------- /contrib/embree/win/embree4.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/embree/win/embree4.lib -------------------------------------------------------------------------------- /contrib/embree/win/tbb.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/embree/win/tbb.lib -------------------------------------------------------------------------------- /contrib/embree/win/tbb12.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/embree/win/tbb12.dll -------------------------------------------------------------------------------- /contrib/embree/win/tbb12.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/contrib/embree/win/tbb12.lib -------------------------------------------------------------------------------- /contrib/gtest-1.6.0/gtest/gtest_prod.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Google C++ Testing Framework definitions useful in production code. 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 35 | #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 36 | 37 | // When you need to test the private or protected members of a class, 38 | // use the FRIEND_TEST macro to declare your tests as friends of the 39 | // class. For example: 40 | // 41 | // class MyClass { 42 | // private: 43 | // void MyMethod(); 44 | // FRIEND_TEST(MyClassTest, MyMethod); 45 | // }; 46 | // 47 | // class MyClassTest : public testing::Test { 48 | // // ... 49 | // }; 50 | // 51 | // TEST_F(MyClassTest, MyMethod) { 52 | // // Can call MyClass::MyMethod() here. 53 | // } 54 | 55 | #define FRIEND_TEST(test_case_name, test_name)\ 56 | friend class test_case_name##_##test_name##_Test 57 | 58 | #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 59 | -------------------------------------------------------------------------------- /hiprt/cache/empty.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/hiprt/cache/empty.h -------------------------------------------------------------------------------- /hiprt/hiprt_libpath.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | 27 | // 28 | // Define the library path that HIPRT will use. 29 | // Order matters: the first library file of the list to exist will be the one loaded. 30 | // 31 | 32 | #ifdef _WIN32 33 | 34 | #ifdef HIPRT_PREFER_HIP_5 35 | const char* g_hip_paths[] = { "amdhip64.dll", "amdhip64_6.dll", NULL }; 36 | #else 37 | const char* g_hip_paths[] = { "amdhip64_6.dll", "amdhip64.dll", NULL }; 38 | #endif 39 | 40 | const char* g_hiprtc_paths[] = { 41 | "hiprtc0605.dll", 42 | "hiprtc0604.dll", 43 | "hiprtc0603.dll", 44 | "hiprtc0602.dll", 45 | "hiprtc0601.dll", 46 | "hiprtc0600.dll", 47 | "hiprtc0507.dll", 48 | "hiprtc0506.dll", 49 | "hiprtc0505.dll", 50 | "hiprtc0504.dll", 51 | "hiprtc0503.dll", 52 | NULL }; 53 | #elif defined( __APPLE__ ) 54 | 55 | const char** g_hip_paths = nullptr; 56 | const char** g_hiprtc_paths = nullptr; 57 | #else 58 | 59 | #ifdef HIPRT_PREFER_HIP_5 60 | const char* g_hip_paths[] = { 61 | "libamdhip64.so.5", 62 | "/opt/rocm/lib/libamdhip64.so.5", 63 | "/opt/rocm/hip/lib/libamdhip64.so.5", 64 | 65 | "libamdhip64.so", 66 | "/opt/rocm/lib/libamdhip64.so", 67 | "/opt/rocm/hip/lib/libamdhip64.so", 68 | NULL }; 69 | #else 70 | const char* g_hip_paths[] = { 71 | "libamdhip64.so", 72 | "/opt/rocm/lib/libamdhip64.so", 73 | "/opt/rocm/hip/lib/libamdhip64.so", 74 | 75 | "libamdhip64.so.5", 76 | "/opt/rocm/lib/libamdhip64.so.5", 77 | "/opt/rocm/hip/lib/libamdhip64.so.5", 78 | NULL }; 79 | #endif 80 | 81 | const char* g_hiprtc_paths[] = { 82 | 83 | "/opt/rocm/hip/lib/libhiprtc.so.6", 84 | "/opt/rocm/lib/libhiprtc.so.6", 85 | "libhiprtc.so.6", 86 | 87 | "/opt/rocm/hip/lib/libhiprtc.so.5", 88 | "/opt/rocm/lib/libhiprtc.so.5", 89 | "libhiprtc.so.5", 90 | 91 | "/opt/rocm/hip/lib/libhiprtc.so", 92 | "/opt/rocm/lib/libhiprtc.so", 93 | "libhiprtc.so", 94 | 95 | NULL }; 96 | #endif 97 | -------------------------------------------------------------------------------- /hiprt/impl/AabbList.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | 27 | namespace hiprt 28 | { 29 | #if !defined( __KERNELCC__ ) 30 | DECLARE_TYPE_TRAITS( hiprt::AabbList ); 31 | #endif 32 | } // namespace hiprt 33 | -------------------------------------------------------------------------------- /hiprt/impl/AabbList.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | #include 27 | #include 28 | 29 | namespace hiprt 30 | { 31 | class AabbList 32 | { 33 | public: 34 | HIPRT_HOST_DEVICE AabbList( const hiprtAABBListPrimitive& list ) 35 | : m_aabbCount( list.aabbCount ), m_aabbStride( list.aabbStride ) 36 | { 37 | m_aabbs = reinterpret_cast( list.aabbs ); 38 | } 39 | 40 | HIPRT_HOST_DEVICE Aabb fetchAabb( uint32_t index ) const 41 | { 42 | const uint32_t halfStride = ( m_aabbStride >> 1 ); 43 | const float* boxMinPtr = reinterpret_cast( m_aabbs + index * m_aabbStride + 0 * halfStride ); 44 | const float* boxMaxPtr = reinterpret_cast( m_aabbs + index * m_aabbStride + 1 * halfStride ); 45 | Aabb box; 46 | box.m_min = { boxMinPtr[0], boxMinPtr[1], boxMinPtr[2] }; 47 | box.m_max = { boxMaxPtr[0], boxMaxPtr[1], boxMaxPtr[2] }; 48 | return box; 49 | } 50 | 51 | HIPRT_HOST_DEVICE float3 fetchCenter( uint32_t index ) const { return fetchAabb( index ).center(); } 52 | 53 | HIPRT_HOST_DEVICE uint32_t getCount() const { return m_aabbCount; } 54 | 55 | private: 56 | const uint8_t* m_aabbs; 57 | uint32_t m_aabbCount; 58 | uint32_t m_aabbStride; 59 | }; 60 | } // namespace hiprt 61 | -------------------------------------------------------------------------------- /hiprt/impl/ApiNodeList.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | #include 27 | #include 28 | 29 | namespace hiprt 30 | { 31 | class ApiNodeList 32 | { 33 | public: 34 | HIPRT_HOST_DEVICE ApiNodeList( const hiprtBvhNodeList& list ) : m_nodeCount( list.nodeCount ) 35 | { 36 | m_nodes = reinterpret_cast( list.nodes ); 37 | } 38 | 39 | HIPRT_HOST_DEVICE ApiNode fetchNode( uint32_t index ) const { return m_nodes[index]; } 40 | 41 | HIPRT_HOST_DEVICE uint32_t getCount() const { return m_nodeCount; } 42 | 43 | private: 44 | const ApiNode* m_nodes; 45 | uint32_t m_nodeCount; 46 | }; 47 | } // namespace hiprt 48 | -------------------------------------------------------------------------------- /hiprt/impl/BatchBuilder.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | #include 27 | 28 | namespace hiprt 29 | { 30 | #if !defined( __KERNELCC__ ) 31 | DECLARE_TYPE_TRAITS( hiprtGeometryBuildInput ); 32 | DECLARE_TYPE_TRAITS( hiprtSceneBuildInput ); 33 | #endif 34 | 35 | size_t BatchBuilder::getStorageBufferSize( const hiprtGeometryBuildInput& buildInput, const hiprtBuildOptions buildOptions ) 36 | { 37 | const size_t primCount = getPrimCount( buildInput ); 38 | const size_t primNodeSize = getPrimNodeSize( buildInput ); 39 | const size_t boxNodeCount = DivideRoundUp( 2 * primCount, 3 ); 40 | return getGeometryStorageBufferSize( primCount, boxNodeCount, primNodeSize ); 41 | } 42 | 43 | size_t BatchBuilder::getStorageBufferSize( const hiprtSceneBuildInput& buildInput, const hiprtBuildOptions buildOptions ) 44 | { 45 | const size_t frameCount = buildInput.frameCount; 46 | const size_t primCount = buildInput.instanceCount; 47 | const size_t boxNodeCount = DivideRoundUp( 2 * primCount, 3 ); 48 | return getSceneStorageBufferSize( primCount, primCount, boxNodeCount, frameCount ); 49 | } 50 | } // namespace hiprt 51 | -------------------------------------------------------------------------------- /hiprt/impl/BvhConfig.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | #include 27 | 28 | namespace hiprt 29 | { 30 | // Cost 31 | static constexpr bool LogBvhCost = false; 32 | // BVH 33 | static constexpr uint32_t BvhBuilderReductionBlockSize = 256u; 34 | static constexpr uint32_t BatchBuilderMaxBlockSize = MaxBatchBuildMaxPrimCount; 35 | static constexpr uint32_t CollapseBlockSize = 1024u; 36 | // LBVH 37 | static constexpr uint32_t LbvhEmitBlockSize = 512u; 38 | // PLOC 39 | static constexpr uint32_t PlocMainBlockSize = 1024u; 40 | static constexpr uint32_t PlocRadius = 8u; 41 | // SBVH 42 | static constexpr uint32_t SbvhMinBinCount = 8u; 43 | static constexpr uint32_t SbvhMaxBinCount = 32u; 44 | static constexpr float SbvhAlpha = 1.5f; 45 | static constexpr float SbvhBeta = 1.0e-4f; 46 | static constexpr float SbvhGamma = 1.0e-3f; 47 | static constexpr float SbvhEpsilon = 1.0e-2f; 48 | }; // namespace hiprt 49 | -------------------------------------------------------------------------------- /hiprt/impl/BvhNode.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | 27 | namespace hiprt 28 | { 29 | #if !defined( __KERNELCC__ ) 30 | DECLARE_TYPE_TRAITS( hiprt::TriangleNode ); 31 | DECLARE_TYPE_TRAITS( hiprt::CustomNode ); 32 | DECLARE_TYPE_TRAITS( hiprt::InstanceNode ); 33 | DECLARE_TYPE_TRAITS( hiprt::ReferenceNode ); 34 | #endif 35 | } // namespace hiprt 36 | -------------------------------------------------------------------------------- /hiprt/impl/Error.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | namespace hiprt 31 | { 32 | void checkOro( oroError res, const source_location& location ) 33 | { 34 | if ( res != oroSuccess ) 35 | { 36 | const char* errStr; 37 | oroGetErrorString( res, &errStr ); 38 | std::string msg = Utility::format( 39 | "Orochi error: '%s' [ %d ] on line %d in '%s'.", 40 | errStr, 41 | static_cast( res ), 42 | location.line(), 43 | location.file_name() ); 44 | throw std::runtime_error( msg ); 45 | } 46 | } 47 | 48 | void checkOrortc( orortcResult res, const source_location& location ) 49 | { 50 | if ( res != ORORTC_SUCCESS ) 51 | { 52 | std::string msg = Utility::format( 53 | "Orortc error: '%s' [ %d ] on line %d in '%s'.", 54 | orortcGetErrorString( res ), 55 | static_cast( res ), 56 | location.line(), 57 | location.file_name() ); 58 | throw std::runtime_error( msg ); 59 | } 60 | } 61 | } // namespace hiprt 62 | -------------------------------------------------------------------------------- /hiprt/impl/Error.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | #include 27 | #include 28 | #include 29 | 30 | namespace hiprt 31 | { 32 | void checkOro( oroError res, const source_location& location = source_location::current() ); 33 | void checkOrortc( orortcResult res, const source_location& location = source_location::current() ); 34 | } // namespace hiprt 35 | -------------------------------------------------------------------------------- /hiprt/impl/Geometry.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | 27 | namespace hiprt 28 | { 29 | struct BoxNode; 30 | 31 | struct GeomHeader 32 | { 33 | BoxNode* m_boxNodes; 34 | void* m_primNodes; 35 | size_t m_size; 36 | uint32_t m_boxNodeCount; 37 | uint32_t m_primNodeCount; 38 | uint32_t m_geomType; 39 | }; 40 | HIPRT_STATIC_ASSERT( alignof( GeomHeader ) <= DefaultAlignment ); 41 | } // namespace hiprt 42 | -------------------------------------------------------------------------------- /hiprt/impl/Instance.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | #include 27 | #include 28 | #include 29 | 30 | namespace hiprt 31 | { 32 | struct alignas( 16 ) Instance 33 | { 34 | uint32_t m_frameIndex; 35 | uint32_t m_frameCount : 31; 36 | uint32_t m_type : 1; 37 | union 38 | { 39 | GeomHeader* m_geometry; 40 | SceneHeader* m_scene; 41 | }; 42 | 43 | HIPRT_HOST_DEVICE const BoxNode* getBoxNodes() const 44 | { 45 | if ( m_type == hiprtInstanceTypeGeometry ) 46 | return m_geometry->m_boxNodes; 47 | else 48 | return m_scene->m_boxNodes; 49 | } 50 | }; 51 | HIPRT_STATIC_ASSERT( sizeof( Instance ) == 16 ); 52 | } // namespace hiprt 53 | -------------------------------------------------------------------------------- /hiprt/impl/InstanceList.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | 27 | namespace hiprt 28 | { 29 | #if !defined( __KERNELCC__ ) 30 | DECLARE_TYPE_TRAITS( hiprt::InstanceList ); 31 | DECLARE_TYPE_TRAITS( hiprt::InstanceList ); 32 | #endif 33 | } // namespace hiprt 34 | -------------------------------------------------------------------------------- /hiprt/impl/Kernel.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | #include 27 | #include 28 | 29 | namespace hiprt 30 | { 31 | class Kernel 32 | { 33 | public: 34 | struct Argument 35 | { 36 | size_t m_size; 37 | size_t m_align; 38 | const void* m_value; 39 | 40 | template 41 | Argument( const T& value ) 42 | { 43 | m_size = sizeof( T ); 44 | m_align = __alignof( T ); 45 | m_value = &value; 46 | } 47 | }; 48 | 49 | Kernel( oroFunction function = 0 ) : m_function( function ) {} 50 | 51 | void setArgs( std::vector args ); 52 | 53 | void launch( 54 | uint32_t gx, 55 | uint32_t gy, 56 | uint32_t gz, 57 | uint32_t bx, 58 | uint32_t by, 59 | uint32_t bz, 60 | uint32_t sharedMemBytes, 61 | oroStream stream ); 62 | 63 | void launch( uint32_t nx, oroStream stream = 0, uint32_t sharedMemBytes = 0 ); 64 | void launch( uint32_t nx, uint32_t tx, oroStream stream = 0, uint32_t sharedMemBytes = 0 ); 65 | 66 | uint32_t getNumSmem(); 67 | uint32_t getNumRegs(); 68 | 69 | private: 70 | oroFunction m_function; 71 | std::vector m_args; 72 | std::vector m_argPtrs; 73 | }; 74 | } // namespace hiprt 75 | -------------------------------------------------------------------------------- /hiprt/impl/Logger.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace hiprt 30 | { 31 | Logger& Logger::getInstance() 32 | { 33 | static Logger s_writer; 34 | return s_writer; 35 | } 36 | 37 | void Logger::print( uint32_t filter, const char* fmt, ... ) 38 | { 39 | if ( ( filter & m_level ) == 0 ) return; 40 | va_list c; 41 | va_start( c, fmt ); 42 | vprintf( fmt, c ); 43 | va_end( c ); 44 | } 45 | }; // namespace hiprt 46 | -------------------------------------------------------------------------------- /hiprt/impl/Logger.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | #include 27 | 28 | namespace hiprt 29 | { 30 | class Logger 31 | { 32 | public: 33 | static Logger& getInstance(); 34 | 35 | void setLevel( uint32_t level ) { m_level = level; } 36 | int getLevel() const { return m_level; } 37 | 38 | void print( uint32_t filter, const char* fmt, ... ); 39 | 40 | protected: 41 | uint32_t m_level = 0; 42 | }; 43 | 44 | template 45 | void log( uint32_t filter, Args... args ) 46 | { 47 | Logger::getInstance().print( filter, args... ); 48 | } 49 | 50 | template 51 | void logInfo( Args... args ) 52 | { 53 | Logger::getInstance().print( hiprtLogLevelInfo, args... ); 54 | } 55 | 56 | template 57 | void logWarn( Args... args ) 58 | { 59 | Logger::getInstance().print( hiprtLogLevelWarn, args... ); 60 | } 61 | 62 | template 63 | void logError( Args... args ) 64 | { 65 | Logger::getInstance().print( hiprtLogLevelError, args... ); 66 | } 67 | }; // namespace hiprt 68 | -------------------------------------------------------------------------------- /hiprt/impl/MemoryArena.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | 27 | namespace hiprt 28 | { 29 | class MemoryArena 30 | { 31 | public: 32 | HIPRT_HOST_DEVICE MemoryArena( hiprtDevicePtr data, size_t storageSize, uint32_t alignment ) 33 | : m_data( data ), m_storageSize( storageSize ), m_alignment( alignment ), m_offset( 0 ) 34 | { 35 | } 36 | 37 | template 38 | HIPRT_HOST_DEVICE T* allocate( size_t size = 1 ) 39 | { 40 | if ( size == 0 ) return nullptr; 41 | T* p = reinterpret_cast( reinterpret_cast( m_data ) + m_offset ); 42 | m_offset += RoundUp( sizeof( T ) * size, m_alignment ); 43 | HIPRT_ASSERT( m_offset <= m_storageSize ); 44 | return p; 45 | } 46 | 47 | HIPRT_HOST_DEVICE size_t getStorageSize() { return m_storageSize; } 48 | 49 | private: 50 | hiprtDevicePtr m_data; 51 | uint32_t m_alignment; 52 | size_t m_offset; 53 | size_t m_storageSize; 54 | }; 55 | } // namespace hiprt 56 | -------------------------------------------------------------------------------- /hiprt/impl/RadixSort.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include "RadixSort.h" 26 | #include "Utility.h" 27 | 28 | #include 29 | 30 | namespace 31 | { 32 | // NOTE: change the path to match where the kernels are stored. 33 | constexpr auto hiprtKernelPath{ "contrib/Orochi/ParallelPrimitives/RadixSortKernels.h" }; 34 | constexpr auto hiprtIncludeDir{ "contrib/Orochi/" }; 35 | } // namespace 36 | 37 | namespace hiprt 38 | { 39 | 40 | RadixSort::RadixSort( oroDevice device, oroStream stream, OrochiUtils& oroutils ) 41 | : m_sort( 42 | device, 43 | oroutils, 44 | stream, 45 | ( Utility::getRootDir() / hiprtKernelPath ).string(), 46 | ( Utility::getRootDir() / hiprtIncludeDir ).string() ) 47 | { 48 | } 49 | 50 | void RadixSort::sort( 51 | uint32_t* inputKeys, 52 | uint32_t* inputValues, 53 | uint32_t* outputKeys, 54 | uint32_t* outputValues, 55 | size_t size, 56 | oroStream stream ) noexcept 57 | { 58 | Oro::RadixSort::KeyValueSoA srcGpu{}; 59 | Oro::RadixSort::KeyValueSoA dstGpu{}; 60 | 61 | srcGpu.key = inputKeys; 62 | srcGpu.value = inputValues; 63 | 64 | dstGpu.key = outputKeys; 65 | dstGpu.value = outputValues; 66 | 67 | static constexpr auto startBit{ 0 }; 68 | static constexpr auto endBit{ 32 }; 69 | 70 | m_sort.sort( srcGpu, dstGpu, static_cast( size ), startBit, endBit, stream ); 71 | } 72 | 73 | } // namespace hiprt 74 | -------------------------------------------------------------------------------- /hiprt/impl/RadixSort.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | namespace hiprt 30 | { 31 | 32 | class RadixSort final 33 | { 34 | public: 35 | RadixSort( oroDevice device, oroStream stream, OrochiUtils& oroutils ); 36 | 37 | void sort( 38 | uint32_t* inputKeys, 39 | uint32_t* inputValues, 40 | uint32_t* outputKeys, 41 | uint32_t* outputValues, 42 | size_t size, 43 | oroStream stream ) noexcept; 44 | 45 | private: 46 | Oro::RadixSort m_sort; 47 | }; 48 | } // namespace hiprt 49 | -------------------------------------------------------------------------------- /hiprt/impl/SbvhCommon.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | #include 27 | 28 | namespace hiprt 29 | { 30 | struct alignas( 32 ) Bin 31 | { 32 | HIPRT_HOST_DEVICE float cost() { return m_box.area() * m_counter; } 33 | 34 | HIPRT_HOST_DEVICE float leftCost() { return m_box.area() * m_enter; } 35 | 36 | HIPRT_HOST_DEVICE float rightCost() { return m_box.area() * m_exit; } 37 | 38 | HIPRT_HOST_DEVICE void reset() 39 | { 40 | m_box.reset(); 41 | m_enter = 0; 42 | m_exit = 0; 43 | } 44 | 45 | HIPRT_HOST_DEVICE void include( const Bin& bin ) 46 | { 47 | m_box.grow( bin.m_box ); 48 | m_enter += bin.m_enter; 49 | m_exit += bin.m_exit; 50 | } 51 | 52 | Aabb m_box; 53 | uint32_t m_enter; 54 | union 55 | { 56 | uint32_t m_counter; 57 | uint32_t m_exit; 58 | }; 59 | }; 60 | HIPRT_STATIC_ASSERT( sizeof( Bin ) == 32 ); 61 | 62 | struct Split 63 | { 64 | HIPRT_HOST_DEVICE void 65 | setSplitInfo( uint8_t splitAxis, uint32_t splitIndex, bool leftLeaf, bool rightLeaf, bool spatialSplit ) 66 | { 67 | m_splitIndex = splitIndex; 68 | m_splitAxis = splitAxis; 69 | m_spatialSplit = spatialSplit; 70 | m_leftLeaf = leftLeaf; 71 | m_rightLeaf = rightLeaf; 72 | } 73 | 74 | uint32_t m_splitIndex : 27; 75 | uint32_t m_splitAxis : 2; 76 | uint32_t m_spatialSplit : 1; 77 | uint32_t m_leftLeaf : 1; 78 | uint32_t m_rightLeaf : 1; 79 | }; 80 | HIPRT_STATIC_ASSERT( sizeof( Split ) == 4 ); 81 | 82 | struct alignas( 64 ) Task 83 | { 84 | Task() = default; 85 | 86 | HIPRT_HOST_DEVICE Task( const Aabb& box, uint32_t refOffset = InvalidValue ) : m_box( box ), m_refOffset( refOffset ) {} 87 | 88 | Aabb m_box; 89 | Aabb m_box0; 90 | Aabb m_box1; 91 | 92 | Split m_split{}; 93 | float m_cost{}; 94 | 95 | union 96 | { 97 | uint32_t m_counter0 = 0; 98 | uint32_t m_taskOffset; 99 | }; 100 | union 101 | { 102 | uint32_t m_counter1 = 0; 103 | uint32_t m_refOffset; 104 | }; 105 | }; 106 | HIPRT_STATIC_ASSERT( sizeof( Task ) == 128 ); 107 | 108 | } // namespace hiprt 109 | -------------------------------------------------------------------------------- /hiprt/impl/Scene.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | #include 27 | #include 28 | 29 | namespace hiprt 30 | { 31 | struct BoxNode; 32 | struct InstanceNode; 33 | struct Instance; 34 | 35 | struct SceneHeader 36 | { 37 | BoxNode* m_boxNodes; 38 | InstanceNode* m_primNodes; 39 | Instance* m_instances; 40 | Frame* m_frames; 41 | size_t m_size; 42 | uint32_t m_primCount; 43 | uint32_t m_primNodeCount; 44 | uint32_t m_boxNodeCount; 45 | uint32_t m_frameCount; 46 | }; 47 | HIPRT_STATIC_ASSERT( alignof( SceneHeader ) <= DefaultAlignment ); 48 | } // namespace hiprt 49 | -------------------------------------------------------------------------------- /hiprt/impl/TriangleMesh.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | 27 | namespace hiprt 28 | { 29 | #if !defined( __KERNELCC__ ) 30 | DECLARE_TYPE_TRAITS( hiprt::TriangleMesh ); 31 | #endif 32 | } // namespace hiprt 33 | -------------------------------------------------------------------------------- /hiprt/impl/Utility.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #if defined( __GNUC__ ) 32 | #include 33 | #include 34 | #include 35 | #endif 36 | 37 | #if defined( _WIN32 ) 38 | #define NOMINMAX 39 | #include 40 | #endif 41 | 42 | namespace hiprt 43 | { 44 | #if !defined( __GNUC__ ) 45 | const HMODULE getCurrentModule() 46 | { 47 | HMODULE hModule = NULL; 48 | // hModule is NULL if GetModuleHandleEx fails. 49 | GetModuleHandleEx( 50 | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, 51 | (LPCTSTR)getCurrentModule, 52 | &hModule ); 53 | return hModule; 54 | } 55 | #else 56 | void getCurrentModule() {} 57 | #endif 58 | 59 | std::filesystem::path Utility::getCurrentDir() 60 | { 61 | #if !defined( __GNUC__ ) 62 | char buff[MAX_PATH]; 63 | GetModuleFileName( getCurrentModule(), buff, MAX_PATH ); 64 | #else 65 | Dl_info info; 66 | dladdr( (const void*)getCurrentModule, &info ); 67 | const char* buff = info.dli_fname; 68 | #endif 69 | std::string::size_type position = std::string( buff ).find_last_of( "\\/" ); 70 | return std::string( buff ).substr( 0, position ) + "/"; 71 | } 72 | 73 | uint32_t Utility::hashString( const std::string& str ) 74 | { 75 | uint32_t hash = 0; 76 | 77 | const char* data = str.data(); 78 | for ( uint32_t i = 0; i < str.length(); ++i ) 79 | { 80 | hash += *data++; 81 | hash += ( hash << 10 ); 82 | hash ^= ( hash >> 6 ); 83 | } 84 | 85 | hash += ( hash << 3 ); 86 | hash ^= ( hash >> 11 ); 87 | hash += ( hash << 15 ); 88 | 89 | return hash; 90 | } 91 | } // namespace hiprt 92 | -------------------------------------------------------------------------------- /hiprt/impl/Utility.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | #include 27 | #include 28 | #include 29 | 30 | namespace hiprt 31 | { 32 | class Context; 33 | 34 | class Utility 35 | { 36 | public: 37 | static std::filesystem::path getCurrentDir(); 38 | 39 | static uint32_t hashString( const std::string& str ); 40 | 41 | template 42 | static std::string format( const std::string& format, Args... args ) 43 | { 44 | int sizeS = std::snprintf( nullptr, 0, format.c_str(), args... ) + 1; 45 | if ( sizeS <= 0 ) 46 | { 47 | throw std::runtime_error( "Error during formatting." ); 48 | } 49 | auto size = static_cast( sizeS ); 50 | std::unique_ptr buf( new char[size] ); 51 | std::snprintf( buf.get(), size, format.c_str(), args... ); 52 | return std::string( buf.get(), buf.get() + size - 1 ); 53 | } 54 | 55 | static std::string getEnvVariable( const std::string& key ) 56 | { 57 | #if defined( __WINDOWS__ ) 58 | char* buffer = nullptr; 59 | size_t bufferCount = 0; 60 | _dupenv_s( &buffer, &bufferCount, key.c_str() ); 61 | const std::string val = buffer != nullptr ? buffer : ""; 62 | delete[] buffer; 63 | #else 64 | const char* const env = getenv( key.c_str() ); 65 | const std::string val = ( env == nullptr ) ? std::string() : std::string( env ); 66 | #endif 67 | return val; 68 | } 69 | 70 | static std::filesystem::path getRootDir() 71 | { 72 | std::string val = getEnvVariable( "HIPRT_PATH" ); 73 | if ( val.empty() ) val = ".."; 74 | return std::filesystem::path( val ); 75 | } 76 | }; 77 | } // namespace hiprt 78 | -------------------------------------------------------------------------------- /hiprt/impl/hiprt_kernels.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #if defined( __CUDACC__ ) 26 | #include 27 | #include 28 | #else 29 | #include 30 | #endif 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | -------------------------------------------------------------------------------- /hiprt/impl/hiprt_kernels_bitcode.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #if defined( __CUDACC__ ) 26 | #include 27 | #include 28 | #else 29 | #include 30 | #endif 31 | #include 32 | #include 33 | -------------------------------------------------------------------------------- /scripts/bitcodes/common_tools.py: -------------------------------------------------------------------------------- 1 | # common_tools.py 2 | 3 | 4 | import os 5 | import subprocess 6 | 7 | def getVCPath(): 8 | try: 9 | vswhere_default_path = r"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" 10 | 11 | if not os.path.exists(vswhere_default_path): 12 | raise IOError("vswhere not found at the default location: {}".format(vswhere_default_path)) 13 | 14 | vswhere_command = [ 15 | vswhere_default_path, 16 | "-latest", 17 | "-products", 18 | "*", 19 | "-requires", 20 | "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", 21 | "-property", 22 | "installationPath" 23 | ] 24 | 25 | vswhere_output = subprocess.check_output(vswhere_command, encoding='utf-8').strip() 26 | 27 | if not vswhere_output: 28 | raise IOError("Visual Studio installation not found.") 29 | 30 | vctools_version_file = os.path.join(vswhere_output, "VC", "Auxiliary", "Build", "Microsoft.VCToolsVersion.default.txt") 31 | 32 | if not os.path.exists(vctools_version_file): 33 | raise IOError("Microsoft.VCToolsVersion.default.txt file not found.") 34 | 35 | with open(vctools_version_file, "r") as file: 36 | vc_tools_version = file.read().strip() 37 | 38 | if not vc_tools_version: 39 | raise ValueError("Failed to read VC Tools version.") 40 | 41 | cl_exe_path = os.path.join(vswhere_output, "VC", "Tools", "MSVC", vc_tools_version) 42 | return cl_exe_path 43 | 44 | except subprocess.CalledProcessError as e: 45 | raise RuntimeError("vswhere command failed: {}".format(e)) 46 | except Exception as e: 47 | raise RuntimeError("An error occurred: {}".format(e)) 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /scripts/concatVersion.py: -------------------------------------------------------------------------------- 1 | f = open("version.txt", "r") 2 | ma = int(f.readline()) 3 | mi = int(f.readline()) 4 | f.close() 5 | 6 | print( ma * 1000 + mi ) 7 | 8 | f = open("tmp.txt", "w") 9 | f.write( str( ma * 1000 + mi ) ) 10 | f.close() -------------------------------------------------------------------------------- /scripts/unittest.bat: -------------------------------------------------------------------------------- 1 | ..\dist\bin\release\unittest64.exe --width=512 --height=512 --referencePath=..\test\references\ --gtest_filter=-*PerformanceTest* --gtest_output=xml:../result.xml 2 | -------------------------------------------------------------------------------- /scripts/unittest.sh: -------------------------------------------------------------------------------- 1 | PWD_PATH=`pwd` 2 | export LD_LIBRARY_PATH="$PWD_PATH/../contrib/embree/linux:${LD_LIBRARY_PATH}" 3 | ../dist/bin/Release/unittest64 --width=512 --height=512 --referencePath=../test/references/ --gtest_filter=-*PerformanceTest* --gtest_output=xml:../result.xml 4 | -------------------------------------------------------------------------------- /scripts/unittest_perf.bat: -------------------------------------------------------------------------------- 1 | ..\dist\bin\release\unittest64.exe --width=512 --height=512 --referencePath=..\test\references\ --gtest_filter=*PerformanceTest* --gtest_output=xml:../result.xml 2 | -------------------------------------------------------------------------------- /scripts/unittest_perf.sh: -------------------------------------------------------------------------------- 1 | PWD_PATH=`pwd` 2 | export LD_LIBRARY_PATH="$PWD_PATH/../contrib/embree/linux:${LD_LIBRARY_PATH}" 3 | ../dist/bin/Release/unittest64 --width=512 --height=512 --referencePath=../test/references/ --gtest_filter=*PerformanceTest* --gtest_output=xml:../result.xml 4 | -------------------------------------------------------------------------------- /scripts/unittest_precomp.bat: -------------------------------------------------------------------------------- 1 | ..\dist\bin\release\unittest64.exe --width=512 --height=512 --precompiled --referencePath=..\test\references\ --gtest_filter=-*PerformanceTest* --gtest_output=xml:../result.xml 2 | -------------------------------------------------------------------------------- /test/bitcodes/custom_func_table.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #define HIPRT_BITCODE_LINKING 26 | #define HIPRT_EXPORTS 27 | 28 | #if defined( __CUDACC__ ) 29 | #include 30 | #include 31 | #else 32 | #include 33 | #endif 34 | 35 | #include 36 | 37 | __device__ bool duplicityFilter( const hiprtRay& ray, const void* data, void* payload, const hiprtHit& hit ); 38 | __device__ bool intersectCircle( const hiprtRay& ray, const void* data, void* payload, hiprtHit& hit ); 39 | __device__ bool intersectSphere( const hiprtRay& ray, const void* data, void* payload, hiprtHit& hit ); 40 | __device__ bool cutoutFilter( const hiprtRay& ray, const void* data, void* payload, const hiprtHit& hit ); 41 | 42 | HIPRT_DEVICE bool intersectFunc( 43 | uint32_t geomType, 44 | uint32_t rayType, 45 | const hiprtFuncTableHeader& tableHeader, 46 | const hiprtRay& ray, 47 | void* payload, 48 | hiprtHit& hit ) 49 | { 50 | const uint32_t index = tableHeader.numGeomTypes * rayType + geomType; 51 | const void* data = tableHeader.funcDataSets[index].intersectFuncData; 52 | switch ( index ) 53 | { 54 | 55 | case 0: { 56 | return intersectCircle( ray, data, payload, hit ); 57 | } 58 | case 1: { 59 | return intersectSphere( ray, data, payload, hit ); 60 | } 61 | 62 | default: { 63 | return false; 64 | } 65 | } 66 | } 67 | 68 | HIPRT_DEVICE bool filterFunc( 69 | uint32_t geomType, 70 | uint32_t rayType, 71 | const hiprtFuncTableHeader& tableHeader, 72 | const hiprtRay& ray, 73 | void* payload, 74 | const hiprtHit& hit ) 75 | { 76 | const uint32_t index = tableHeader.numGeomTypes * rayType + geomType; 77 | const void* data = tableHeader.funcDataSets[index].filterFuncData; 78 | switch ( index ) 79 | { 80 | 81 | case 2: { 82 | return duplicityFilter( ray, data, payload, hit ); 83 | } 84 | case 3: { 85 | return cutoutFilter( ray, data, payload, hit ); 86 | } 87 | 88 | default: { 89 | return false; 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /test/bitcodes/unit_test.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | ////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | #define HIPRT_BITCODE_LINKING 26 | #if defined( __CUDACC__ ) 27 | #include 28 | #include 29 | #else 30 | #include 31 | #endif 32 | #include "../kernels/HiprtTestKernel.h" 33 | #include "../kernels/PrimaryRayKernel.h" 34 | #include "../kernels/ShadowRayKernel.h" 35 | #include "../kernels/AoRayKernel.h" -------------------------------------------------------------------------------- /test/common/meshes/cornellbox/cornellBox.mtl: -------------------------------------------------------------------------------- 1 | newmtl Light 2 | Ns 00.000000 3 | Ka 1.000000 1.000000 1.000000 4 | Kd 1.000000 1.000000 1.000000 5 | Ks 0.000000 0.000000 0.000000 6 | Ke 1.000000 1.000000 1.000000 7 | Ni 1.000000 8 | d 1.000000 9 | illum 2 10 | 11 | newmtl DarkGreen 12 | Ns 96.078431 13 | Ka 1.000000 1.000000 1.000000 14 | Kd 0.000000 0.320000 0.000000 15 | Ks 0.500000 0.500000 0.500000 16 | Ke 0.000000 0.000000 0.000000 17 | Ni 1.000000 18 | d 1.000000 19 | illum 2 20 | 21 | newmtl Khaki 22 | Ns 96.078431 23 | Ka 1.000000 1.000000 1.000000 24 | Kd 0.800000 0.659341 0.439560 25 | Ks 0.500000 0.500000 0.500000 26 | Ke 0.000000 0.000000 0.000000 27 | Ni 1.000000 28 | d 1.000000 29 | illum 2 30 | 31 | newmtl Grey 32 | Ns 96.078431 33 | Ka 1.000000 1.000000 1.000000 34 | Kd 0.500000 0.500000 0.500000 35 | Ks 0.500000 0.500000 0.500000 36 | Ke 0.000000 0.000000 0.000000 37 | Ni 1.000000 38 | d 1.000000 39 | illum 2 40 | 41 | newmtl BloodyRed 42 | Ns 96.078431 43 | Ka 1.000000 1.000000 1.000000 44 | Kd 0.445000 0.000000 0.000000 45 | Ks 0.500000 0.500000 0.500000 46 | Ke 0.000000 0.000000 0.000000 47 | Ni 1.000000 48 | d 1.000000 49 | illum 2 -------------------------------------------------------------------------------- /test/references/AoRayBistro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/AoRayBistro.png -------------------------------------------------------------------------------- /test/references/AoRayCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/AoRayCornellBox.png -------------------------------------------------------------------------------- /test/references/AoRayHairball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/AoRayHairball.png -------------------------------------------------------------------------------- /test/references/BvhBalancedBistro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/BvhBalancedBistro.png -------------------------------------------------------------------------------- /test/references/BvhBalancedCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/BvhBalancedCornellBox.png -------------------------------------------------------------------------------- /test/references/BvhFastBistro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/BvhFastBistro.png -------------------------------------------------------------------------------- /test/references/BvhFastCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/BvhFastCornellBox.png -------------------------------------------------------------------------------- /test/references/BvhHighQBistro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/BvhHighQBistro.png -------------------------------------------------------------------------------- /test/references/BvhHighQCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/BvhHighQCornellBox.png -------------------------------------------------------------------------------- /test/references/BvhIoApi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/BvhIoApi.png -------------------------------------------------------------------------------- /test/references/BvhUpdateCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/BvhUpdateCornellBox.png -------------------------------------------------------------------------------- /test/references/CustomBvhImport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/CustomBvhImport.png -------------------------------------------------------------------------------- /test/references/CustomIntersection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/CustomIntersection.png -------------------------------------------------------------------------------- /test/references/Cutout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/Cutout.png -------------------------------------------------------------------------------- /test/references/HitDistCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/HitDistCornellBox.png -------------------------------------------------------------------------------- /test/references/MeshIntersection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/MeshIntersection.png -------------------------------------------------------------------------------- /test/references/MinimumCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/MinimumCornellBox.png -------------------------------------------------------------------------------- /test/references/MotionBlur.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/MotionBlur.png -------------------------------------------------------------------------------- /test/references/MotionBlurSlerp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/MotionBlurSlerp.png -------------------------------------------------------------------------------- /test/references/NormalsCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/NormalsCornellBox.png -------------------------------------------------------------------------------- /test/references/PairTriangles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/PairTriangles.png -------------------------------------------------------------------------------- /test/references/PrimIdsCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/PrimIdsCornellBox.png -------------------------------------------------------------------------------- /test/references/PrimaryRayBistro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/PrimaryRayBistro.png -------------------------------------------------------------------------------- /test/references/PrimaryRayCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/PrimaryRayCornellBox.png -------------------------------------------------------------------------------- /test/references/RayMaskCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/RayMaskCornellBox.png -------------------------------------------------------------------------------- /test/references/Rebuild0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/Rebuild0.png -------------------------------------------------------------------------------- /test/references/Rebuild1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/Rebuild1.png -------------------------------------------------------------------------------- /test/references/RotateCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/RotateCornellBox.png -------------------------------------------------------------------------------- /test/references/ScaleCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/ScaleCornellBox.png -------------------------------------------------------------------------------- /test/references/SceneIntersection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/SceneIntersection.png -------------------------------------------------------------------------------- /test/references/SceneIntersectionMlas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/SceneIntersectionMlas.png -------------------------------------------------------------------------------- /test/references/SceneIntersectionSingleton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/SceneIntersectionSingleton.png -------------------------------------------------------------------------------- /test/references/ShadowRayCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/ShadowRayCornellBox.png -------------------------------------------------------------------------------- /test/references/Shear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/Shear.png -------------------------------------------------------------------------------- /test/references/TranslateCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/TranslateCornellBox.png -------------------------------------------------------------------------------- /test/references/Update0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/Update0.png -------------------------------------------------------------------------------- /test/references/Update1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/Update1.png -------------------------------------------------------------------------------- /test/references/UvsCornellBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/test/references/UvsCornellBox.png -------------------------------------------------------------------------------- /tools/genArgs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from __future__ import print_function 3 | 4 | import sys 5 | import os 6 | 7 | def genArgs( fileName, api, includes ): 8 | f = open(fileName) 9 | iName = os.path.basename( fileName ).split('.')[0] 10 | 11 | print( '#if !defined(HIPRT_LOAD_FROM_STRING) && !defined(HIPRT_BITCODE_LINKING)' ) 12 | print( ' static const char** '+iName+'Args = 0;' ) 13 | print( '#else' ) 14 | print( ' static const char* '+iName+'Args[] = {' ) 15 | includes += iName +'Includes[] = {' 16 | for line in f.readlines(): 17 | a = line.strip('\r\n') 18 | if a.find('#include') == -1: 19 | continue 20 | if a.find('#include') != -1 and a.find('inl.' + api) != -1: 21 | continue 22 | if (api == 'cl' or api == 'metal') and a.find('.cu') != -1: 23 | continue 24 | if (a.find('"') != -1 and a.find('#include') != -1): 25 | continue 26 | 27 | filename = os.path.basename(a.split('<')[1].split('>')[0]) 28 | includes += '"' + a.split('<')[1].split('>')[0] + '",' 29 | name = filename.split('.' + api)[0] 30 | name = name.split('.h')[0] 31 | name = api + '_'+name 32 | print ( name + ',' ) 33 | print( api + '_'+iName+'};' ) 34 | print( '#endif' ) 35 | return includes 36 | 37 | argvs = sys.argv 38 | 39 | files = [] 40 | if len(argvs) >= 2: 41 | files.append( argvs[1] ) 42 | 43 | print( '#pragma once' ) 44 | 45 | # Looking for CL, CU/HIP and Metal files 46 | #extensions = ['cl', 'metal', 'cu'] 47 | #files = [name for name in files if any(name.endswith(ext) for ext in extensions)] 48 | 49 | # Filter out inlines 50 | #extensions = ['.inl.cl', '.inl.cu' '.inl.metal', 'MetalHeader.metal'] # FIXME so we don't need to filter this explicitly 51 | #files = [name for name in files if not any(name.endswith(ext) for ext in extensions)] 52 | 53 | # Detect API (CL, CU or Metal). Should probably abort here if we detect a mix of extensions 54 | api = 'cl' if any(name.endswith('cl') for name in files) else 'metal' 55 | if(api == 'metal'): 56 | api = 'cu' if any(name.endswith('cu') for name in files) else 'metal' 57 | api = 'hip' 58 | 59 | # Visit each file 60 | print( 'namespace ' + api + ' {') 61 | #map(lambda name: genArgs(dir + name, api), files) 62 | includes = 'static const char* ' 63 | for s in files: 64 | includes = genArgs(s, api, includes) 65 | includes += '};' 66 | print( includes ) 67 | print( '}\t//namespace ' + api) 68 | -------------------------------------------------------------------------------- /tools/premake5/linux64/premake5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/tools/premake5/linux64/premake5 -------------------------------------------------------------------------------- /tools/premake5/osx/premake5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/tools/premake5/osx/premake5 -------------------------------------------------------------------------------- /tools/premake5/win/premake5.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/HIPRT/e1052282631a52a4fc19ef0d4eff39e733435174/tools/premake5/win/premake5.exe -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 5 3 | a21e075 4 | --------------------------------------------------------------------------------