Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project 0: Xuntong Liang #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 41 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,47 @@ Project 0 Getting Started

**University of Pennsylvania, CIS 565: GPU Programming and Architecture, Project 0**

* (TODO) YOUR NAME HERE
* (TODO) [LinkedIn](), [personal website](), [twitter](), etc.
* Tested on: (TODO) Windows 22, i7-2222 @ 2.22GHz 22GB, GTX 222 222MB (Moore 2222 Lab)
* Xuntong Liang
* [LinkedIn](https://www.linkedin.com/in/xuntong-liang-406429181/), [GitHub](https://github.com/PacosLelouch), [twitter](https://twitter.com/XTL90234545).
* Tested on: Windows 10, i7-10750H @ 2.60GHz 16GB, RTX 2070 Super with Max-Q 8192MB

### (TODO: Your README)
### Part 3.1: CUDA

Include screenshots, analysis, etc. (Remember, this is public, so don't put
anything here that you don't want to share with the world.)
CUDA running result:

![CUDA Test](images/cuda.png)



Analysis:

![CUDA Analysis](images/cuda-analysis.png)

This needs us to go to `Nsight` -> `Nsight Systems 2021.2.4` -> `Trace`.

Then in `NVIDIA Nsight Systems 2021.2.4 `, `Select target for profiling` -> `Start`. Make sure to fill in the correct `Command line with arguments` and `Working directory` in `Target application`, and check `Collect CUDA trace` and `Collect OpenGL trace`.



Debug with Nsight:

![Debug with Nsight](images/cuda-debug.png)

The `blockIdx` is (12, 0, 0) and the `threadIdx` is (8, 1, 0). The thread counts from the `Shader Info` are discontinuous, and the threads between these thread indices are shown in `Threads`. We need to calculate that which is (8, 1, 0). Since the `blockDim` is (16, 16, 1), threads represented by (x, 1, 0) should be in the third or fourth group of threads. Then we can count x = 8, and find the corresponding thread, which is the first thread of the fourth group of threads.



### Part 3.2: WebGL

Check WebGL support:

![Check WebGL support](images/webgl2support.png)



### Part 3.3: DXR

DXR test, with color (0.2, 0.4, 0.8):

![DXR Test](images/dxr.png)

4 changes: 2 additions & 2 deletions cuda-getting-started/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* C main function.
*/
int main(int argc, char* argv[]) {
// TODO: Change this line to use your name!
m_yourName = "TODO: YOUR NAME HERE";
// DONE: Change this line to use your name!
m_yourName = "Xuntong Liang";

if (init(argc, argv)) {
mainLoop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ void D3D12RaytracingHelloWorld::EnableDirectXRaytracing(IDXGIAdapter1* adapter)

void D3D12RaytracingHelloWorld::OnInit()
{
// Modify my adapter ID to get NVIDIA GPU.
m_adapterIDoverride = 1;

m_deviceResources = std::make_unique<DeviceResources>(
DXGI_FORMAT_R8G8B8A8_UNORM,
DXGI_FORMAT_UNKNOWN,
Expand Down
3 changes: 2 additions & 1 deletion dxr-support/src/D3D12RaytracingHelloWorld/Raytracing.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ void MyRaygenShader()
[shader("closesthit")]
void MyClosestHitShader(inout RayPayload payload, in MyAttributes attr)
{
float3 barycentrics = float3(1 - attr.barycentrics.x - attr.barycentrics.y, attr.barycentrics.x, attr.barycentrics.y);
// float3 barycentrics = float3(1 - attr.barycentrics.x - attr.barycentrics.y, attr.barycentrics.x, attr.barycentrics.y);
float3 barycentrics = float3(0.2, 0.4, 0.8);
payload.color = float4(barycentrics, 1);
}

Expand Down
Binary file added images/cuda-analysis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cuda-debug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cuda.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/dxr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/webgl2support.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.