Skip to content

Commit bbeef57

Browse files
committed
Fix formatting
Created using spr 1.3.5
2 parents f67a77f + 71792dc commit bbeef57

File tree

36 files changed

+3598
-537
lines changed

36 files changed

+3598
-537
lines changed

clang/lib/Sema/SemaAMDGPU.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,19 @@ bool SemaAMDGPU::CheckAMDGCNBuiltinFunctionCall(unsigned BuiltinID,
9393
return true;
9494
}
9595
}
96-
if (ArgTys[0] != ArgTys[1]) {
97-
SemaRef.Diag(Args[1]->getBeginLoc(),
98-
diag::err_typecheck_call_different_arg_types)
99-
<< ArgTys[0] << ArgTys[1];
100-
return true;
101-
}
102-
return false;
96+
if (getASTContext().hasSameUnqualifiedType(ArgTys[0], ArgTys[1]))
97+
return false;
98+
if (((ArgTys[0]->isUnsignedIntegerType() &&
99+
ArgTys[1]->isSignedIntegerType()) ||
100+
(ArgTys[0]->isSignedIntegerType() &&
101+
ArgTys[1]->isUnsignedIntegerType())) &&
102+
getASTContext().getTypeSize(ArgTys[0]) ==
103+
getASTContext().getTypeSize(ArgTys[1]))
104+
return false;
105+
SemaRef.Diag(Args[1]->getBeginLoc(),
106+
diag::err_typecheck_call_different_arg_types)
107+
<< ArgTys[0] << ArgTys[1];
108+
return true;
103109
}
104110
default:
105111
return false;

clang/test/CodeGenOpenCL/builtins-amdgcn-vi.cl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,29 @@ void test_update_dpp_half(half *x, global half *p) {
218218
*p = __builtin_amdgcn_update_dpp(*x, *x, 0x101, 0xf, 0xf, 0);
219219
}
220220

221+
// CHECK-LABEL: @test_update_dpp_int_uint
222+
// CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.update.dpp.i32(i32 %arg1, i32 %arg2, i32 0, i32 0, i32 0, i1 false)
223+
void test_update_dpp_int_uint(global int* out, int arg1, unsigned int arg2)
224+
{
225+
*out = __builtin_amdgcn_update_dpp(arg1, arg2, 0, 0, 0, false);
226+
}
227+
228+
// CHECK-LABEL: @test_update_dpp_lit_int
229+
// CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.update.dpp.i32(i32 5, i32 %arg1, i32 0, i32 0, i32 0, i1 false)
230+
void test_update_dpp_lit_int(global int* out, int arg1)
231+
{
232+
*out = __builtin_amdgcn_update_dpp(5, arg1, 0, 0, 0, false);
233+
}
234+
235+
__constant int gi = 5;
236+
237+
// CHECK-LABEL: @test_update_dpp_const_int
238+
// CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.update.dpp.i32(i32 5, i32 %arg1, i32 0, i32 0, i32 0, i1 false)
239+
void test_update_dpp_const_int(global int* out, int arg1)
240+
{
241+
*out = __builtin_amdgcn_update_dpp(gi, arg1, 0, 0, 0, false);
242+
}
243+
221244
// CHECK-LABEL: @test_ds_fadd
222245
// CHECK: atomicrmw fadd ptr addrspace(3) %out, float %src monotonic, align 4{{$}}
223246
// CHECK: atomicrmw volatile fadd ptr addrspace(3) %out, float %src monotonic, align 4{{$}}

clang/test/SemaOpenCL/builtins-amdgcn-error-gfx9.cl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ void test_update_dpp(global int* out, int arg1, int arg2, int i, int2 i2, long l
5656
*out = __builtin_amdgcn_update_dpp(fc, arg2, 0, 0, 0, false); // expected-error{{used type '__private _Complex float' where integer or floating point type is required}}
5757
*out = __builtin_amdgcn_update_dpp(arg1, fc, 0, 0, 0, false); // expected-error{{used type '__private _Complex float' where integer or floating point type is required}}
5858
*out = __builtin_amdgcn_update_dpp(i, l, 0, 0, 0, false); // expected-error{{arguments are of different types ('__private int' vs '__private long')}}
59+
*out = __builtin_amdgcn_update_dpp(0.5f, i, 0, 0, 0, false); // expected-error{{arguments are of different types ('float' vs '__private int')}}
5960
}

flang/include/flang/Optimizer/Transforms/CufOpConversion.h renamed to flang/include/flang/Optimizer/Transforms/CUFOpConversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===------- Optimizer/Transforms/CufOpConversion.h -------------*- C++ -*-===//
1+
//===------- Optimizer/Transforms/CUFOpConversion.h -------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -19,7 +19,7 @@ class LLVMTypeConverter;
1919
namespace mlir {
2020
class DataLayout;
2121
class SymbolTable;
22-
}
22+
} // namespace mlir
2323

2424
namespace cuf {
2525

flang/include/flang/Optimizer/Transforms/Passes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace fir {
4040
#define GEN_PASS_DECL_CHARACTERCONVERSION
4141
#define GEN_PASS_DECL_CFGCONVERSION
4242
#define GEN_PASS_DECL_CUFADDCONSTRUCTOR
43-
#define GEN_PASS_DECL_CUFIMPLICITDEVICEGLOBAL
43+
#define GEN_PASS_DECL_CUFDEVICEGLOBAL
4444
#define GEN_PASS_DECL_CUFOPCONVERSION
4545
#define GEN_PASS_DECL_EXTERNALNAMECONVERSION
4646
#define GEN_PASS_DECL_MEMREFDATAFLOWOPT

flang/include/flang/Optimizer/Transforms/Passes.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,15 +421,15 @@ def AssumedRankOpConversion : Pass<"fir-assumed-rank-op", "mlir::ModuleOp"> {
421421
];
422422
}
423423

424-
def CufOpConversion : Pass<"cuf-convert", "mlir::ModuleOp"> {
424+
def CUFOpConversion : Pass<"cuf-convert", "mlir::ModuleOp"> {
425425
let summary = "Convert some CUF operations to runtime calls";
426426
let dependentDialects = [
427427
"fir::FIROpsDialect"
428428
];
429429
}
430430

431-
def CufImplicitDeviceGlobal :
432-
Pass<"cuf-implicit-device-global", "mlir::ModuleOp"> {
431+
def CUFDeviceGlobal :
432+
Pass<"cuf-device-global", "mlir::ModuleOp"> {
433433
let summary = "Flag globals used in device function with data attribute";
434434
let dependentDialects = [
435435
"cuf::CUFDialect"

flang/lib/Optimizer/Transforms/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ add_flang_library(FIRTransforms
1010
ConstantArgumentGlobalisation.cpp
1111
ControlFlowConverter.cpp
1212
CUFAddConstructor.cpp
13-
CufImplicitDeviceGlobal.cpp
14-
CufOpConversion.cpp
13+
CUFDeviceGlobal.cpp
14+
CUFOpConversion.cpp
1515
ArrayValueCopy.cpp
1616
ExternalNameConversion.cpp
1717
MemoryUtils.cpp

flang/lib/Optimizer/Transforms/CufImplicitDeviceGlobal.cpp renamed to flang/lib/Optimizer/Transforms/CUFDeviceGlobal.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- CufOpConversion.cpp -----------------------------------------------===//
1+
//===-- CUFOpConversion.cpp -----------------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -18,7 +18,7 @@
1818
#include "mlir/Transforms/DialectConversion.h"
1919

2020
namespace fir {
21-
#define GEN_PASS_DEF_CUFIMPLICITDEVICEGLOBAL
21+
#define GEN_PASS_DEF_CUFDEVICEGLOBAL
2222
#include "flang/Optimizer/Transforms/Passes.h.inc"
2323
} // namespace fir
2424

@@ -45,8 +45,7 @@ static void prepareImplicitDeviceGlobals(mlir::func::FuncOp funcOp,
4545
}
4646
}
4747

48-
class CufImplicitDeviceGlobal
49-
: public fir::impl::CufImplicitDeviceGlobalBase<CufImplicitDeviceGlobal> {
48+
class CUFDeviceGlobal : public fir::impl::CUFDeviceGlobalBase<CUFDeviceGlobal> {
5049
public:
5150
void runOnOperation() override {
5251
mlir::Operation *op = getOperation();

flang/lib/Optimizer/Transforms/CufOpConversion.cpp renamed to flang/lib/Optimizer/Transforms/CUFOpConversion.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
//===-- CufOpConversion.cpp -----------------------------------------------===//
1+
//===-- CUFDeviceGlobal.cpp -----------------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "flang/Optimizer/Transforms/CufOpConversion.h"
9+
#include "flang/Optimizer/Transforms/CUFOpConversion.h"
1010
#include "flang/Common/Fortran.h"
1111
#include "flang/Optimizer/Builder/Runtime/RTBuilder.h"
1212
#include "flang/Optimizer/CodeGen/TypeConverter.h"
@@ -619,7 +619,7 @@ struct CufDataTransferOpConversion
619619
const mlir::SymbolTable &symtab;
620620
};
621621

622-
class CufOpConversion : public fir::impl::CufOpConversionBase<CufOpConversion> {
622+
class CUFOpConversion : public fir::impl::CUFOpConversionBase<CUFOpConversion> {
623623
public:
624624
void runOnOperation() override {
625625
auto *ctx = &getContext();

flang/runtime/CUDA/registration.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ namespace Fortran::runtime::cuda {
1414

1515
extern "C" {
1616

17-
extern void **__cudaRegisterFatBinary(void *data);
17+
extern void **__cudaRegisterFatBinary(void *);
18+
extern void __cudaRegisterFatBinaryEnd(void *);
1819
extern void __cudaRegisterFunction(void **fatCubinHandle, const char *hostFun,
1920
char *deviceFun, const char *deviceName, int thread_limit, uint3 *tid,
2021
uint3 *bid, dim3 *bDim, dim3 *gDim, int *wSize);
2122

2223
void *RTDECL(CUFRegisterModule)(void *data) {
23-
return __cudaRegisterFatBinary(data);
24+
void **fatHandle{__cudaRegisterFatBinary(data)};
25+
__cudaRegisterFatBinaryEnd(fatHandle);
26+
return fatHandle;
2427
}
2528

2629
void RTDEF(CUFRegisterFunction)(void **module, const char *fct) {

0 commit comments

Comments
 (0)