1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

clang-format: Apply formatting to HIP sources with .hip extension

This commit is contained in:
Brad King
2025-04-09 12:08:48 -04:00
parent 11f67538c1
commit b8dd3b208a
7 changed files with 19 additions and 23 deletions

1
.gitattributes vendored
View File

@@ -60,6 +60,7 @@ coverage.xml.in tab-indent
*.H our-c-style
*.h our-c-style
*.hh our-c-style
*.hip our-c-style
*.hpp our-c-style
*.hxx our-c-style
*.notcu our-c-style

View File

@@ -1,15 +1,14 @@
#include <system_error>
#include <type_traits>
#include <hip/hip_runtime_api.h>
static __global__ void fake_hip_kernel()
{
}
int __host__ interface_hip_func(int x)
{
fake_hip_kernel<<<1, 1>>>();
bool valid = (hipSuccess == hipGetLastError());
if (!valid) {

View File

@@ -1,15 +1,14 @@
#include <system_error>
#include <type_traits>
#include <hip/hip_runtime_api.h>
static __global__ void fake_hip_kernel()
{
}
int __host__ interface_hip_func(int x)
{
fake_hip_kernel<<<1, 1>>>();
bool valid = (hipSuccess == hipGetLastError());
if (!valid) {

View File

@@ -1,15 +1,15 @@
#include <stdexcept>
#include <cmath>
#include <math.h>
#include <memory>
#include <stdexcept>
#include <hip/hip_runtime.h>
#include <hip/hip_fp16.h>
#include <hip/hip_runtime.h>
#include <math.h>
namespace {
template <class T, class F>
__global__ void global_entry_point(F f, T *out) {
__global__ void global_entry_point(F f, T* out)
{
*out = f();
}
@@ -23,7 +23,9 @@ bool verify(F f, T expected)
}
bool result = true;
hipLaunchKernelGGL(global_entry_point, 1, 1, 0, 0, f, gpu_T);
result = hipMemcpy(cpu_T.get(), gpu_T, sizeof(T), hipMemcpyDeviceToHost) == hipSuccess && result;
result = hipMemcpy(cpu_T.get(), gpu_T, sizeof(T), hipMemcpyDeviceToHost) ==
hipSuccess &&
result;
result = hipFree(gpu_T) == hipSuccess && result;
result = *cpu_T == expected && result;
return result;

View File

@@ -1,5 +1,6 @@
#include <system_error>
#include <type_traits>
#include <hip/hip_runtime_api.h>
#ifdef _WIN32
@@ -8,15 +9,12 @@
# define EXPORT
#endif
static __global__ void fake_hip_kernel()
{
}
int __host__ shared_hip_func(int x)
{
fake_hip_kernel<<<1, 1>>>();
bool valid = (hipSuccess == hipGetLastError());
if (!valid) {

View File

@@ -1,17 +1,14 @@
#include <type_traits>
#include <system_error>
#include <hip/hip_runtime_api.h>
#include <type_traits>
#include <hip/hip_runtime_api.h>
static __global__ void fake_hip_kernel()
{
}
int __host__ static_hip_func(int x)
{
fake_hip_kernel<<<1, 1>>>();
bool valid = (hipSuccess == hipGetLastError());
if (!valid) {

View File

@@ -1,4 +1,5 @@
#include <system_error>
#include <hip/hip_runtime_api.h>
static __global__ void fake_hip_kernel()
@@ -7,7 +8,6 @@ static __global__ void fake_hip_kernel()
int __host__ try_compile_hip_func(int x)
{
fake_hip_kernel<<<1, 1>>>();
bool valid = (hipSuccess == hipGetLastError());
if (!valid) {