<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/clang/test/OpenMP/amdgpu_exceptions.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[test] %clang_cc1 -analyze: remove redundant actions</title>
<updated>2024-05-06T17:36:19+00:00</updated>
<author>
<name>Fangrui Song</name>
<email>i@maskray.me</email>
</author>
<published>2024-05-06T17:36:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e4d242768aefabc0091dd01fabecaffbc2b6984b'/>
<id>e4d242768aefabc0091dd01fabecaffbc2b6984b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[test] %clang_cc1 -emit-llvm: remove redundant -S</title>
<updated>2024-05-05T00:31:08+00:00</updated>
<author>
<name>Fangrui Song</name>
<email>i@maskray.me</email>
</author>
<published>2024-05-05T00:31:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c4c3efa161edf7313d1aeda07cd82fab90c3717c'/>
<id>c4c3efa161edf7313d1aeda07cd82fab90c3717c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add REQUIRES: staticanalyzer to some tests using clang -analyze</title>
<updated>2023-08-31T07:37:04+00:00</updated>
<author>
<name>Hans Wennborg</name>
<email>hans@chromium.org</email>
</author>
<published>2023-08-31T07:35:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1968f0d7981df2d508c7c862d875b115837208b3'/>
<id>1968f0d7981df2d508c7c862d875b115837208b3</id>
<content type='text'>
Otherwise they fail in builds configured with
-DCLANG_ENABLE_STATIC_ANALYZER=OFF. Follow-up to
3c9988f85d2508bdbc64c81fed7c4b9b8db54262.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Otherwise they fail in builds configured with
-DCLANG_ENABLE_STATIC_ANALYZER=OFF. Follow-up to
3c9988f85d2508bdbc64c81fed7c4b9b8db54262.
</pre>
</div>
</content>
</entry>
<entry>
<title>[OpenMP] Allow exceptions in target regions when offloading to GPUs</title>
<updated>2023-08-30T16:36:22+00:00</updated>
<author>
<name>Anton Rydahl</name>
<email>rydahl2610@gmail.com</email>
</author>
<published>2023-08-30T16:34:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3c9988f85d2508bdbc64c81fed7c4b9b8db54262'/>
<id>3c9988f85d2508bdbc64c81fed7c4b9b8db54262</id>
<content type='text'>
The motivation for this patch is that many code bases use exception handling. As GPUs are not expected to support exception handling in the near future, we can experiment with compiling the code for GPU targets anyway. This will
allow us to run the code, as long as no exception is thrown.

The overall idea is very simple:
- If a throw expression is compiled to AMDGCN or NVPTX, it is replaced with a trap during code generation.
- If a try/catch statement is compiled to AMDGCN or NVPTX, we generate code for the try statement as if it were a basic block.

With this patch, the compilation of the following example
```
int gaussian_sum(int a,int b){
	if ((a + b) % 2 == 0) {throw -1;};
	return (a+b) * ((a+b)/2);
}

int main(void) {
	int gauss = 0;
	#pragma omp target map(from:gauss)
	{
		try {
			gauss = gaussian_sum(1,100);
		}
		catch (int e){
			gauss = e;
		}
	}
	std::cout &lt;&lt; "GaussianSum(1,100)="&lt;&lt;gauss&lt;&lt;std::endl;
        #pragma omp target map(from:gauss)
        {
                try {
                     	gauss = gaussian_sum(1,101);
                }
                catch (int e){
                        gauss = e;
                }
        }
	std::cout &lt;&lt; "GaussianSum(1,101)="&lt;&lt;gauss&lt;&lt;std::endl;
	return (gauss &gt; 1) ? 0 : 1;
}
```
with offloading to `gfx906` results in
```
./bin/target_try_minimal_fail
GaussianSum(1,100)=5050
AMDGPU fatal error 1: Received error in queue 0x155555506000: HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception.
zsh: abort (core dumped)
```

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D153924
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The motivation for this patch is that many code bases use exception handling. As GPUs are not expected to support exception handling in the near future, we can experiment with compiling the code for GPU targets anyway. This will
allow us to run the code, as long as no exception is thrown.

The overall idea is very simple:
- If a throw expression is compiled to AMDGCN or NVPTX, it is replaced with a trap during code generation.
- If a try/catch statement is compiled to AMDGCN or NVPTX, we generate code for the try statement as if it were a basic block.

With this patch, the compilation of the following example
```
int gaussian_sum(int a,int b){
	if ((a + b) % 2 == 0) {throw -1;};
	return (a+b) * ((a+b)/2);
}

int main(void) {
	int gauss = 0;
	#pragma omp target map(from:gauss)
	{
		try {
			gauss = gaussian_sum(1,100);
		}
		catch (int e){
			gauss = e;
		}
	}
	std::cout &lt;&lt; "GaussianSum(1,100)="&lt;&lt;gauss&lt;&lt;std::endl;
        #pragma omp target map(from:gauss)
        {
                try {
                     	gauss = gaussian_sum(1,101);
                }
                catch (int e){
                        gauss = e;
                }
        }
	std::cout &lt;&lt; "GaussianSum(1,101)="&lt;&lt;gauss&lt;&lt;std::endl;
	return (gauss &gt; 1) ? 0 : 1;
}
```
with offloading to `gfx906` results in
```
./bin/target_try_minimal_fail
GaussianSum(1,100)=5050
AMDGPU fatal error 1: Received error in queue 0x155555506000: HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception.
zsh: abort (core dumped)
```

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D153924
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[OpenMP] Allow exceptions in target regions when offloading to GPUs"</title>
<updated>2023-08-29T22:59:47+00:00</updated>
<author>
<name>antonrydahl</name>
<email>rydahl2610@gmail.com</email>
</author>
<published>2023-08-29T22:59:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7af0eff5405bb88dc96c0b19892da0fbb44db433'/>
<id>7af0eff5405bb88dc96c0b19892da0fbb44db433</id>
<content type='text'>
This reverts commit 4c62e943b7178127861ca39163a0ed4caeb14943.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 4c62e943b7178127861ca39163a0ed4caeb14943.
</pre>
</div>
</content>
</entry>
<entry>
<title>[OpenMP] Allow exceptions in target regions when offloading to GPUs</title>
<updated>2023-08-29T22:05:59+00:00</updated>
<author>
<name>Anton Rydahl</name>
<email>rydahl2610@gmail.com</email>
</author>
<published>2023-08-29T22:03:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4c62e943b7178127861ca39163a0ed4caeb14943'/>
<id>4c62e943b7178127861ca39163a0ed4caeb14943</id>
<content type='text'>
The motivation for this patch is that many code bases use exception handling. As GPUs are not expected to support exception handling in the near future, we can experiment with compiling the code for GPU targets anyway. This will
allow us to run the code, as long as no exception is thrown.

The overall idea is very simple:
- If a throw expression is compiled to AMDGCN or NVPTX, it is replaced with a trap during code generation.
- If a try/catch statement is compiled to AMDGCN or AMDHSA, we ganerate code for the try statement as if it were a basic block.

With this patch, the compilation of the following example
```
int gaussian_sum(int a,int b){
	if ((a + b) % 2 == 0) {throw -1;};
	return (a+b) * ((a+b)/2);
}

int main(void) {
	int gauss = 0;
	#pragma omp target map(from:gauss)
	{
		try {
			gauss = gaussian_sum(1,100);
		}
		catch (int e){
			gauss = e;
		}
	}
	std::cout &lt;&lt; "GaussianSum(1,100)="&lt;&lt;gauss&lt;&lt;std::endl;
        #pragma omp target map(from:gauss)
        {
                try {
                     	gauss = gaussian_sum(1,101);
                }
                catch (int e){
                        gauss = e;
                }
        }
	std::cout &lt;&lt; "GaussianSum(1,101)="&lt;&lt;gauss&lt;&lt;std::endl;
	return (gauss &gt; 1) ? 0 : 1;
}
```
with offloading to `gfx906` results in
```
./bin/target_try_minimal_fail
GaussianSum(1,100)=5050
AMDGPU fatal error 1: Received error in queue 0x155555506000: HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception.
zsh: abort (core dumped)
```
Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D153924
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The motivation for this patch is that many code bases use exception handling. As GPUs are not expected to support exception handling in the near future, we can experiment with compiling the code for GPU targets anyway. This will
allow us to run the code, as long as no exception is thrown.

The overall idea is very simple:
- If a throw expression is compiled to AMDGCN or NVPTX, it is replaced with a trap during code generation.
- If a try/catch statement is compiled to AMDGCN or AMDHSA, we ganerate code for the try statement as if it were a basic block.

With this patch, the compilation of the following example
```
int gaussian_sum(int a,int b){
	if ((a + b) % 2 == 0) {throw -1;};
	return (a+b) * ((a+b)/2);
}

int main(void) {
	int gauss = 0;
	#pragma omp target map(from:gauss)
	{
		try {
			gauss = gaussian_sum(1,100);
		}
		catch (int e){
			gauss = e;
		}
	}
	std::cout &lt;&lt; "GaussianSum(1,100)="&lt;&lt;gauss&lt;&lt;std::endl;
        #pragma omp target map(from:gauss)
        {
                try {
                     	gauss = gaussian_sum(1,101);
                }
                catch (int e){
                        gauss = e;
                }
        }
	std::cout &lt;&lt; "GaussianSum(1,101)="&lt;&lt;gauss&lt;&lt;std::endl;
	return (gauss &gt; 1) ? 0 : 1;
}
```
with offloading to `gfx906` results in
```
./bin/target_try_minimal_fail
GaussianSum(1,100)=5050
AMDGPU fatal error 1: Received error in queue 0x155555506000: HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception.
zsh: abort (core dumped)
```
Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D153924
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[OpenMP] Allow exceptions in target regions when offloading to GPUs"</title>
<updated>2023-08-29T07:09:21+00:00</updated>
<author>
<name>antonrydahl</name>
<email>rydahl2610@gmail.com</email>
</author>
<published>2023-08-29T07:09:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e5d8160040f69d9084e89260eec85f98038611b5'/>
<id>e5d8160040f69d9084e89260eec85f98038611b5</id>
<content type='text'>
Reverting commit 0cfc2dba93b172802b580713a492ea14148a0218 because it broke
build-bots that do not support nvptx64 targets.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reverting commit 0cfc2dba93b172802b580713a492ea14148a0218 because it broke
build-bots that do not support nvptx64 targets.
</pre>
</div>
</content>
</entry>
<entry>
<title>[OpenMP] Allow exceptions in target regions when offloading to GPUs</title>
<updated>2023-08-29T05:36:13+00:00</updated>
<author>
<name>Anton Rydahl</name>
<email>rydahl2610@gmail.com</email>
</author>
<published>2023-08-29T05:33:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0cfc2dba93b172802b580713a492ea14148a0218'/>
<id>0cfc2dba93b172802b580713a492ea14148a0218</id>
<content type='text'>
The motivation for this patch is that many code bases use exception handling. As GPUs are not expected to support exception handling in the near future, we can experiment with compiling the code for GPU targets anyway. This will
allow us to run the code, as long as no exception is thrown.

The overall idea is very simple:
- If a throw expression is compiled to AMDGCN or NVPTX, it is replaced with a trap during code generation.
- If a try/catch statement is compiled to AMDGCN or AMDHSA, we ganerate code for the try statement as if it were a basic block.

With this patch, the compilation of the following example
```{C++}
int gaussian_sum(int a,int b){
	if ((a + b) % 2 == 0) {throw -1;};
	return (a+b) * ((a+b)/2);
}

int main(void) {
	int gauss = 0;
	#pragma omp target map(from:gauss)
	{
		try {
			gauss = gaussian_sum(1,100);
		}
		catch (int e){
			gauss = e;
		}
	}
	std::cout &lt;&lt; "GaussianSum(1,100)="&lt;&lt;gauss&lt;&lt;std::endl;
        #pragma omp target map(from:gauss)
        {
                try {
                     	gauss = gaussian_sum(1,101);
                }
                catch (int e){
                        gauss = e;
                }
        }
	std::cout &lt;&lt; "GaussianSum(1,101)="&lt;&lt;gauss&lt;&lt;std::endl;
	return (gauss &gt; 1) ? 0 : 1;
}
```
with offloading to `gfx906` results in
```{bash}
./bin/target_try_minimal_fail
GaussianSum(1,100)=5050
AMDGPU fatal error 1: Received error in queue 0x155555506000: HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception.
zsh: abort (core dumped)
```

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D153924
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The motivation for this patch is that many code bases use exception handling. As GPUs are not expected to support exception handling in the near future, we can experiment with compiling the code for GPU targets anyway. This will
allow us to run the code, as long as no exception is thrown.

The overall idea is very simple:
- If a throw expression is compiled to AMDGCN or NVPTX, it is replaced with a trap during code generation.
- If a try/catch statement is compiled to AMDGCN or AMDHSA, we ganerate code for the try statement as if it were a basic block.

With this patch, the compilation of the following example
```{C++}
int gaussian_sum(int a,int b){
	if ((a + b) % 2 == 0) {throw -1;};
	return (a+b) * ((a+b)/2);
}

int main(void) {
	int gauss = 0;
	#pragma omp target map(from:gauss)
	{
		try {
			gauss = gaussian_sum(1,100);
		}
		catch (int e){
			gauss = e;
		}
	}
	std::cout &lt;&lt; "GaussianSum(1,100)="&lt;&lt;gauss&lt;&lt;std::endl;
        #pragma omp target map(from:gauss)
        {
                try {
                     	gauss = gaussian_sum(1,101);
                }
                catch (int e){
                        gauss = e;
                }
        }
	std::cout &lt;&lt; "GaussianSum(1,101)="&lt;&lt;gauss&lt;&lt;std::endl;
	return (gauss &gt; 1) ? 0 : 1;
}
```
with offloading to `gfx906` results in
```{bash}
./bin/target_try_minimal_fail
GaussianSum(1,100)=5050
AMDGPU fatal error 1: Received error in queue 0x155555506000: HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception.
zsh: abort (core dumped)
```

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D153924
</pre>
</div>
</content>
</entry>
</feed>
