Re: [PATCH] D21567: [OpenCL] Generate struct type for sampler_t and function call for the initializer

2016-07-11 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 63556. yaxunl marked 3 inline comments as done. yaxunl added a comment. Revised by Anastia's comments. Disabled warning for sampler enum value by default. http://reviews.llvm.org/D21567 Files: include/clang/AST/OperationKinds.def include/clang/Basic/Dia

Re: [PATCH] D21567: [OpenCL] Generate struct type for sampler_t and function call for the initializer

2016-07-11 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 63571. yaxunl added a comment. Added test for invalid sampler values. http://reviews.llvm.org/D21567 Files: include/clang/AST/OperationKinds.def include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td lib/AST/ASTContext.cpp

Re: [PATCH] D21567: [OpenCL] Generate struct type for sampler_t and function call for the initializer

2016-07-13 Thread Yaxun Liu via cfe-commits
yaxunl marked 11 inline comments as done. Comment at: lib/CodeGen/CGOpenCLRuntime.cpp:83 @@ +82,3 @@ +SamplerTy = llvm::PointerType::get(llvm::StructType::create( + CGM.getLLVMContext(), "__sampler"), + CGM.getContext().getTargetAddressSpace( Anastas

r275318 - [OpenCL] Fixes failures in test/Driver/opencl.cl.

2016-07-13 Thread Yaxun Liu via cfe-commits
Author: yaxunl Date: Wed Jul 13 16:21:05 2016 New Revision: 275318 URL: http://llvm.org/viewvc/llvm-project?rev=275318&view=rev Log: [OpenCL] Fixes failures in test/Driver/opencl.cl. Also fixes strict-aliasing option to only be allowed when OpenCL Version 1.0. Added testcase in test/Frontend/ope

Re: [PATCH] D22170: [OpenCL] Fixes opencl.cl testcase issues and cl-strict-aliasing only allowed with cl-std=CL

2016-07-13 Thread Yaxun Liu via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL275318: [OpenCL] Fixes failures in test/Driver/opencl.cl. (authored by yaxunl). Changed prior to commit: http://reviews.llvm.org/D22170?vs=63722&id=63862#toc Repository: rL LLVM http://reviews.llvm.

Re: [PATCH] D21567: [OpenCL] Generate struct type for sampler_t and function call for the initializer

2016-07-13 Thread Yaxun Liu via cfe-commits
yaxunl updated the summary for this revision. yaxunl updated this revision to Diff 63897. yaxunl marked 3 inline comments as done. yaxunl added a comment. Revised by Anastasia's comments. This fixes multiple function call of `__translate_sampler_initializer` for function-scope sampler variables.

Re: [PATCH] D21567: [OpenCL] Generate struct type for sampler_t and function call for the initializer

2016-07-15 Thread Yaxun Liu via cfe-commits
yaxunl marked 11 inline comments as done. Comment at: test/CodeGenOpenCL/sampler.cl:2 @@ +1,3 @@ +// RUN: %clang_cc1 %s -emit-llvm -triple spir-unknown-unknown -o - -O0 | FileCheck %s + +#define CLK_ADDRESS_CLAMP_TO_EDGE 2 Fixed and moved to sema test. ===

Re: [PATCH] D21567: [OpenCL] Generate struct type for sampler_t and function call for the initializer

2016-07-15 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 64154. yaxunl added a comment. Turn on -Wspir-compat for spir target by default. Diagnose invalid sampler value at Sema instead of Codegen. https://reviews.llvm.org/D21567 Files: include/clang/AST/OperationKinds.def include/clang/Basic/DiagnosticGroups.

Re: [PATCH] D17578: [OpenCL]Allowing explicit conversion of "0" to event_t type

2016-02-26 Thread Yaxun Liu via cfe-commits
yaxunl added inline comments. Comment at: lib/Sema/SemaCast.cpp:2317 @@ +2316,3 @@ +// OpenCL v2.0 s6.13.10 - Allow casts from '0' to event_t type. +if (Self.getLangOpts().OpenCL && DestType->isEventT()) { + llvm::APSInt intValue; tstellarAMD wrote: >

Re: [PATCH] D17412: PR19957: [OpenCL] incorrectly accepts implicit address space conversion with ternary operator

2016-02-26 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 49232. yaxunl marked 7 inline comments as done. yaxunl added a comment. Revised as Anastasis suggested. Modified mergeTypes() for un-handled case. Separate sema tests for condition operator to a new file. Repository: rL LLVM http://reviews.llvm.org/D17412

Re: [PATCH] D17412: PR19957: [OpenCL] incorrectly accepts implicit address space conversion with ternary operator

2016-02-26 Thread Yaxun Liu via cfe-commits
yaxunl added inline comments. Comment at: lib/AST/ASTContext.cpp:7605 @@ -7604,3 +7604,3 @@ // If two types are identical, they are compatible. if (LHSCan == RHSCan) return LHS; Anastasia wrote: > I feel like the AS check should be lifted here instead,

Re: [PATCH] D17552: Pass -backend-option to LLVM when there is no target machine

2016-03-03 Thread Yaxun Liu via cfe-commits
yaxunl updated the summary for this revision. yaxunl added a reviewer: tstellarAMD. yaxunl removed a subscriber: tstellarAMD. yaxunl updated this revision to Diff 49781. yaxunl added a comment. Add a test for -backend-option with and w/o target machine as suggested by Tom. http://reviews.llvm.or

Re: [PATCH] D17861: [OpenCL] Accept __attribute__((nosvm))

2016-03-09 Thread Yaxun Liu via cfe-commits
yaxunl marked 7 inline comments as done. Comment at: include/clang/Basic/Attr.td:701 @@ -699,1 +700,3 @@ +def OpenCLNoSVM : Attr { + let Spellings = [GNU<"nosvm">]; aaron.ballman wrote: > Since the attribute is ignored by clang, you should inherit from IgnoredA

Re: [PATCH] D18095: Add __attribute__((linkonce_odr_linkage))

2016-03-14 Thread Yaxun Liu via cfe-commits
yaxunl added a comment. Thanks for your comments. It works like this, e.g. $ cat prog.ll declare i32 @foo() define void @use_foo() { %a = call i32 @foo() ret void } $ cat lib_common.ll define linkonce_odr i32 @foo() { ret i32 1; } $ cat lib_opt.ll define linkonce_odr i32 @foo() {

Re: [PATCH] D18095: Add __attribute__((linkonce_odr_linkage))

2016-03-14 Thread Yaxun Liu via cfe-commits
yaxunl added a comment. My last example is not proper. In real cases, the functions are overridden by functions with the same name and semantics but optimized for speed. Besides, we want unused library functions in lib_common.ll and lib_opt.ll to be dropped, weak attribute does not achieve that

Re: [PATCH] D18095: Add __attribute__((linkonce_odr_linkage))

2016-03-14 Thread Yaxun Liu via cfe-commits
yaxunl added a comment. Yes we want the overriding functions to be allowed to be inlined. Repository: rL LLVM http://reviews.llvm.org/D18095 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cf

Re: [PATCH] D18095: Add __attribute__((linkonce_odr_linkage))

2016-03-14 Thread Yaxun Liu via cfe-commits
yaxunl added a comment. we can turn off inlining when we build lib_common.ll, then do optimization and inlining after linking with lib_common.ll and lib_opt.ll. Even if linkonce_odr allows inlining, it is still OK. Repository: rL LLVM http://reviews.llvm.org/D18095 __

Re: [PATCH] D17955: [OpenCL] Fix pipe builtin bugs

2016-03-22 Thread Yaxun Liu via cfe-commits
yaxunl accepted this revision. yaxunl added a comment. This revision is now accepted and ready to land. LGTM. Thanks. http://reviews.llvm.org/D17955 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listin

Re: [PATCH] D17861: [OpenCL] Accept __attribute__((nosvm))

2016-03-22 Thread Yaxun Liu via cfe-commits
yaxunl marked an inline comment as done. Comment at: include/clang/Basic/Attr.td:701 @@ -699,1 +700,3 @@ +def OpenCLNoSVM : Attr { + let Spellings = [GNU<"nosvm">]; aaron.ballman wrote: > yaxunl wrote: > > aaron.ballman wrote: > > > Since the attribute is ignor

Re: [PATCH] D18095: Add __attribute__((linkonce_odr_linkage))

2016-03-22 Thread Yaxun Liu via cfe-commits
yaxunl updated the summary for this revision. yaxunl removed rL LLVM as the repository for this revision. yaxunl updated this revision to Diff 51297. yaxunl added a comment. Simplify description of this attribute in AttrDocs since it causes some confusion. http://reviews.llvm.org/D18095 Files:

Re: [PATCH] D18095: Add __attribute__((linkonce_odr_linkage))

2016-03-22 Thread Yaxun Liu via cfe-commits
yaxunl added a comment. If __attribute__((linkonce_odr_linkage)) is not a proper name for explicitly setting linkage, how about __attribute((linkage=linkonce_odr))? This can be extended to other linkages too. http://reviews.llvm.org/D18095 ___ cfe

Re: [PATCH] D17552: Pass -backend-option to LLVM when there is no target machine

2016-03-22 Thread Yaxun Liu via cfe-commits
yaxunl marked an inline comment as done. Comment at: test/Frontend/backend-option.c:2 @@ +1,3 @@ +// RUN: %clang_cc1 %s -emit-llvm -backend-option -time-passes -o - 2>&1 | FileCheck %s +// RUN: %clang_cc1 %s -emit-llvm -backend-option -time-passes -o - -triple spir-unknown-unkno

Re: [PATCH] D17552: Pass -backend-option to LLVM when there is no target machine

2016-03-22 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 51326. yaxunl marked an inline comment as done. yaxunl added a comment. Add -x cl to the test when compiling it for spir target. http://reviews.llvm.org/D17552 Files: lib/CodeGen/BackendUtil.cpp test/Frontend/backend-option.c Index: test/Frontend/backen

Re: [PATCH] D18095: Add __attribute__((linkonce_odr_linkage))

2016-03-22 Thread Yaxun Liu via cfe-commits
yaxunl added a comment. Sorry my previous example may have caused some confusion. Previously I said I wanted to override function definitions. However the only reason we want to add this attribute is so that unused functions will be dropped by the linker. http://reviews.llvm.org/D18095 ___

Re: [PATCH] D17412: PR19957: [OpenCL] incorrectly accepts implicit address space conversion with ternary operator

2016-03-23 Thread Yaxun Liu via cfe-commits
yaxunl marked 15 inline comments as done. Comment at: lib/AST/ASTContext.cpp:7613 @@ +7612,3 @@ +if (getLangOpts().OpenCL) { + if (LHS.getUnqualifiedType() != RHS.getUnqualifiedType() || + LQuals.getCVRQualifiers() != RQuals.getCVRQualifiers()) p

Re: [PATCH] D17412: PR19957: [OpenCL] incorrectly accepts implicit address space conversion with ternary operator

2016-03-23 Thread Yaxun Liu via cfe-commits
yaxunl removed rL LLVM as the repository for this revision. yaxunl updated this revision to Diff 51460. yaxunl marked 13 inline comments as done. yaxunl added a comment. Added comments. Revised test. http://reviews.llvm.org/D17412 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/AST/AS

Re: [PATCH] D17861: [OpenCL] Accept __attribute__((nosvm))

2016-03-28 Thread Yaxun Liu via cfe-commits
yaxunl removed rL LLVM as the repository for this revision. yaxunl updated this revision to Diff 51821. yaxunl marked 4 inline comments as done. yaxunl added a comment. Revised by Aaron's and Anastasia's comments. Changed error/warning message for invalid usage of nosvm attribute. http://review

[PATCH] D16686: [OpenCL] Generate metadata for opencl_unroll_hint attribute

2016-01-28 Thread Yaxun Liu via cfe-commits
yaxunl created this revision. yaxunl added reviewers: Anastasia, pxli168, pekka.jaaskelainen. yaxunl added subscribers: tstellarAMD, cfe-commits. Add codegen and diagnostics for opencl_unroll_hint attribute. The code is based on Khronos OpenCL compiler (https://github.com/KhronosGroup/SPIR/tree/

Re: [PATCH] D16692: [OpenCL] Eliminate warning when declaring OpenCL builtin functions

2016-01-29 Thread Yaxun Liu via cfe-commits
yaxunl updated the summary for this revision. yaxunl updated this revision to Diff 46390. yaxunl added a comment. revised as Xiuli suggested. http://reviews.llvm.org/D16692 Files: lib/Sema/SemaLookup.cpp test/SemaOpenCL/builtin.cl Index: test/SemaOpenCL/builtin.cl =

Re: [PATCH] D16692: [OpenCL] Eliminate warning when declaring OpenCL builtin functions

2016-01-29 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 46395. yaxunl marked an inline comment as done. yaxunl added a comment. revised as Anastasia suggested. http://reviews.llvm.org/D16692 Files: lib/Sema/SemaLookup.cpp test/SemaOpenCL/builtin.cl Index: test/SemaOpenCL/builtin.cl ==

Re: [PATCH] D16686: [OpenCL] Generate metadata for opencl_unroll_hint attribute

2016-01-29 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 46434. yaxunl marked 17 inline comments as done. yaxunl added a comment. Revised as Anastasia and Xiuli suggested. http://reviews.llvm.org/D16686 Files: include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/DiagnosticParseKind

[clang] [llvm] [AMDGPU] Add an option to disable unsafe uses of atomic xor (PR #69229)

2024-02-14 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > We're gradually converging on something that looks like this, subject to bike > shedding the name I did not know about this PR. It is interesting that our other discussions lead to similar solution. I agree that per-instruction metadata is needed, and the metadata should con

[clang] [HIP] Allow partial linking for `-fgpu-rdc` (PR #81700)

2024-02-14 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu updated https://github.com/llvm/llvm-project/pull/81700 >From 6006975bbff9fc0f6fb9b8e24a52d4963ceb774c Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Tue, 13 Feb 2024 10:00:21 -0500 Subject: [PATCH] [HIP] Allow partial linking for `-fgpu-rdc` `-fgpu-rdc` mod

[clang] [clang][CodeGen] Shift relink option implementation away from module cloning (PR #81693)

2024-02-14 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. LGTM. Thanks https://github.com/llvm/llvm-project/pull/81693 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HIP] Allow partial linking for `-fgpu-rdc` (PR #81700)

2024-02-15 Thread Yaxun Liu via cfe-commits
@@ -36,6 +47,146 @@ static std::string normalizeForBundler(const llvm::Triple &T, : T.normalize(); } +// Collect undefined __hip_fatbin* and __hip_gpubin_handle* symbols from all +// input object or archive files. +class HIPUndefinedFatBinSymbols { +publi

[clang] [HIP] Allow partial linking for `-fgpu-rdc` (PR #81700)

2024-02-15 Thread Yaxun Liu via cfe-commits
@@ -36,6 +47,146 @@ static std::string normalizeForBundler(const llvm::Triple &T, : T.normalize(); } +// Collect undefined __hip_fatbin* and __hip_gpubin_handle* symbols from all +// input object or archive files. +class HIPUndefinedFatBinSymbols { +publi

[clang] [HIP] Allow partial linking for `-fgpu-rdc` (PR #81700)

2024-02-15 Thread Yaxun Liu via cfe-commits
@@ -36,6 +47,146 @@ static std::string normalizeForBundler(const llvm::Triple &T, : T.normalize(); } +// Collect undefined __hip_fatbin* and __hip_gpubin_handle* symbols from all +// input object or archive files. +class HIPUndefinedFatBinSymbols { +publi

[clang] [libcxx] [SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (PR #77768)

2024-02-21 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: This PR caused a regression for AMDMIGraphX https://github.com/ROCm/AMDMIGraphX/blob/develop/src/targets/gpu/include/migraphx/gpu/prefix_scan_sum.hpp#L57 A reduced test case is: #include #include using namespace std; ``` struct A { int x; A(int x_) : x(x_) {} A(co

[clang] [libcxx] [SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (PR #77768)

2024-02-21 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: The issue above seems to be a clang bug to me according to https://cplusplus.github.io/CWG/issues/1467.html List-initialization of an object or reference of type T is defined as follows: If T is a class type and the initializer list has a single element of type cv T or a class

[clang] [HIP] Allow partial linking for `-fgpu-rdc` (PR #81700)

2024-02-21 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu updated https://github.com/llvm/llvm-project/pull/81700 >From d84645f035609e7ece76c1f2eb06637826b7b22a Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Tue, 13 Feb 2024 10:00:21 -0500 Subject: [PATCH] [HIP] Allow partial linking for `-fgpu-rdc` `-fgpu-rdc` mod

[clang] [HIP] Allow partial linking for `-fgpu-rdc` (PR #81700)

2024-02-21 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > This makes sense overall, though it's very complicated. Generally we just > need to make sure these things are private to one group of files. There's a > lot more to parse here compared to the `linker-wrapper`. > > Do any of these tests check when called with `-r`? I'm assumi

[clang] [HIP] Allow partial linking for `-fgpu-rdc` (PR #81700)

2024-02-22 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu updated https://github.com/llvm/llvm-project/pull/81700 >From 1e9c29c4794ed6d60cf54c902cd0f854afd1aace Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Tue, 13 Feb 2024 10:00:21 -0500 Subject: [PATCH] [HIP] Allow partial linking for `-fgpu-rdc` `-fgpu-rdc` mod

[clang] [HIP] Allow partial linking for `-fgpu-rdc` (PR #81700)

2024-02-22 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu closed https://github.com/llvm/llvm-project/pull/81700 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CodeGen] Add query for a target's flat address space (PR #95728)

2024-07-02 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > I still think we should not need this. DefaultIsPrivate is junk that needs to > be deleted. Querying for LangAS::Default should always give the answer 0 for > AMDGPU, which is what this is working around. > > This clang notion of address space has nothing to do with your trou

[clang] [llvm] [clang][CodeGen][AMDGPU] Enable AMDGPU `printf` for `spirv64-amd-amdhsa` (PR #97132)

2024-07-02 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/97132 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Compiler messages on HIP SDK for Windows (PR #97668)

2024-07-04 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: better add a lit test like https://github.com/llvm/llvm-project/blob/main/clang/test/Driver/rocm-detect.hip , but for windows only (`REQUIRES: system-windows`), using `--print-rocm-search-dirs`, and checks `ROCm installation search path`. https://github.com/llvm/llvm-project/p

[clang] [HIP][Clang][CodeGen] Handle hip bin symbols properly. (PR #107458)

2024-09-05 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: The current behavior of clang is expected. when gpu binary is not specified, it is expected to be used for -fgpu-rdc and the __hip_gpubin_handle_ symbol needs to be external and unique since they may need to be merged for partial linking. Make them internal will break partial

[clang] [HIP][Clang][CodeGen] Handle hip bin symbols properly. (PR #107458)

2024-09-05 Thread Yaxun Liu via cfe-commits
@@ -840,8 +840,10 @@ llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() { FatBinStr = new llvm::GlobalVariable( CGM.getModule(), CGM.Int8Ty, /*isConstant=*/true, llvm::GlobalValue::ExternalLinkage, nullptr, - "__hip_fatbin_" + CGM.getCo

[clang] [HIP][Clang][CodeGen] Handle hip bin symbols properly. (PR #107458)

2024-09-06 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: you need to update lit test clang/test/CodeGenCUDA/device-stub.cu as it fails now [clang/test/CodeGenCUDA/device-stub.cu](https://buildkite.com/llvm-project/github-pull-requests/builds/98392#0191c73e-12f8-4cf3-9618-d3fd752f9149) https://github.com/llvm/llvm-project/pull/107458

[clang] [HIP] Use original file path for CUID (PR #107734)

2024-09-07 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu created https://github.com/llvm/llvm-project/pull/107734 to avoid being nondeterministic due to random path in distributed build. >From 725953ccbdb1f57eaac234cf5729f64a9fdbce13 Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Sat, 7 Sep 2024 20:32:48 -0400 Sub

[clang] [CUDA/HIP] propagate -cuid to a host-only compilation. (PR #107483)

2024-09-07 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. LGTM. Thanks https://github.com/llvm/llvm-project/pull/107483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][AMDGPU][Driver] Move 'shouldSkipSanitizeOption' utility to AMDGPU. (PR #107997)

2024-09-10 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/107997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][HIP] Target-dependent overload resolution in declarators and specifiers (PR #103031)

2024-09-10 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,703 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify=expected,onhost %s +// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fsyntax-only -fcuda-is-device -verify=expected,ondevice %s + + +// Tests to ensure that functions with host and device

[clang] [HIP][Clang][CodeGen] Handle hip bin symbols properly. (PR #107458)

2024-09-10 Thread Yaxun Liu via cfe-commits
@@ -905,10 +907,10 @@ llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() { GpuBinaryHandle = new llvm::GlobalVariable( TheModule, PtrTy, /*isConstant=*/false, Linkage, /*Initializer=*/ -CudaGpuBinary ? llvm::ConstantPointerNull::get(PtrTy) :

[clang] [HIP][Clang][CodeGen] Handle hip bin symbols properly. (PR #107458)

2024-09-10 Thread Yaxun Liu via cfe-commits
@@ -30,8 +28,6 @@ // RUN: 2>&1 | FileCheck -check-prefix=LD-R %s // LD-R: Found undefined HIP fatbin symbol: __hip_fatbin_[[ID1:[0-9a-f]+]] // LD-R: Found undefined HIP fatbin symbol: __hip_fatbin_[[ID2:[0-9a-f]+]] -// LD-R: Found undefined HIP gpubin handle symbol: __hip_gpu

[clang] [HIP][Clang][CodeGen] Handle hip bin symbols properly. (PR #107458)

2024-09-10 Thread Yaxun Liu via cfe-commits
@@ -175,7 +175,6 @@ __device__ void device_use() { // HIP-SAME: section ".hipFatBinSegment" // * variable to save GPU binary handle after initialization // CUDANORDC: @__[[PREFIX]]_gpubin_handle = internal global ptr null -// HIPNEF: @__[[PREFIX]]_gpubin_handle_{{[0-9a-f]+}} =

[clang] [HIP][Clang][CodeGen] Handle hip bin symbols properly. (PR #107458)

2024-09-10 Thread Yaxun Liu via cfe-commits
@@ -905,10 +907,10 @@ llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() { GpuBinaryHandle = new llvm::GlobalVariable( TheModule, PtrTy, /*isConstant=*/false, Linkage, /*Initializer=*/ -CudaGpuBinary ? llvm::ConstantPointerNull::get(PtrTy) :

[clang] [RFC] Add clang atomic control options and pragmas (PR #102569)

2024-08-08 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu edited https://github.com/llvm/llvm-project/pull/102569 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [RFC] Add clang atomic control options and pragmas (PR #102569)

2024-08-09 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > Thank you for the patch, but RFCs for Clang should be published in > https://discourse.llvm.org/c/clang/6. PRs doesn't have the visibility we want > RFCs to have. Discourse topic created: https://discourse.llvm.org/t/rfc-add-clang-atomic-control-options-and-pragmas/80641. T

[clang] [RFC] Add clang atomic control options and pragmas (PR #102569)

2024-08-09 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu edited https://github.com/llvm/llvm-project/pull/102569 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CUDA] Emit used function list in deterministic order. (PR #102661)

2024-08-12 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. LGTM. Thanks https://github.com/llvm/llvm-project/pull/102661 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] clang/AMDGPU: Emit atomicrmw for __builtin_amdgcn_global_atomic_fadd_{f32|f64} (PR #96872)

2024-08-15 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/96872 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix sema checks thinking kernels aren't kernels (PR #104460)

2024-08-15 Thread Yaxun Liu via cfe-commits
@@ -7147,7 +7147,9 @@ void Sema::ProcessDeclAttributeList( // good to have a way to specify "these attributes must appear as a group", // for these. Additionally, it would be good to have a way to specify "these // attribute must never appear as a group" for attributes li

[clang] [Clang] Fix sema checks thinking kernels aren't kernels (PR #104460)

2024-08-15 Thread Yaxun Liu via cfe-commits
@@ -7163,7 +7165,8 @@ void Sema::ProcessDeclAttributeList( } else if (const auto *A = D->getAttr()) { Diag(D->getLocation(), diag::err_opencl_kernel_attr) << A; D->setInvalidDecl(); -} else if (!D->hasAttr()) { +} else if (!D->hasAttr() && --

[clang] [CUDA][HIP] Fix record layout on Windows (PR #87651)

2024-04-05 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > > Keeping layout in sync makes sense to me, but I'm completely unfamiliar > > with the windows side. > > @rnk is there anything else we need to worry about? > > I checked, and I think this routes everything over to the MS record layout > builder, so it should be comprehensive

[clang] [LinkerWrapper] Relax ordering of static libraries for offloading (PR #87532)

2024-04-09 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: if a.o depends on b.o in libb.a, and b.o depends on c.o in libb.a, will the linker wrapper be able to link all the dependencies? For archive of objects with embedded device bitcode, why not creating an archive of device bitcode for each required target ID and let lld handle the

[clang] [LinkerWrapper] Relax ordering of static libraries for offloading (PR #87532)

2024-04-10 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. LGTM. Thanks https://github.com/llvm/llvm-project/pull/87532 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CUDA][HIP] Fix record layout on Windows (PR #87651)

2024-04-10 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu updated https://github.com/llvm/llvm-project/pull/87651 >From fcebb8226599160fd6e6e42356f78d0b1d4367d4 Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Thu, 4 Apr 2024 12:09:04 -0400 Subject: [PATCH] [CUDA][HIP] Fix record layout on Windows On windows, record

[clang] [CUDA][HIP] Fix record layout on Windows (PR #87651)

2024-04-10 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > In general, having different C++ ABIs between the host and device seems like > an ongoing source of tension and bugs. I agree. However completely switching to Microsoft ABI on device side does not work with existing device libraries since they assume Itanium mangling. Theref

[clang] [HIP] document difference with CUDA (PR #86838)

2024-04-10 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu closed https://github.com/llvm/llvm-project/pull/86838 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [AMDGPU] add macro `__AMDGCN_CDNA_VERSION__` (PR #88293)

2024-04-10 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu created https://github.com/llvm/llvm-project/pull/88293 If a processor belongs to CDNA generation, pre-define macro `__AMDGCN_CDNA_VERSION__` as an integer. Fixes: https://github.com/ROCm/llvm-project/issues/59 >From 9016641211513ffc9ef5b90eb78f2be064e6d3b5 Mon Sep

[clang] [Clang][HIP] Suppress availability diagnostics for mismatched host/device overloads (PR #93546)

2024-06-05 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > Ping. You situation is similar to overloading resolution of functions called in global variable initializer. You may consider using a similar approach as https://reviews.llvm.org/D158247 https://github.com/llvm/llvm-project/pull/93546

[clang] [CUDA][HIP] warn incompatible redeclare (PR #77359)

2024-06-06 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: ping Our users keep requesting this feature since they want their HIP code works with both nvcc and clang. I tested it with real HIP apps and did not see warnings emitted for clang wrapper headers and HIP system headers. Only warnings for users' own code were emitted. Also sin

[clang] [llvm] [clang][CodeGen] `used` globals are fake (PR #93601)

2024-06-06 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/93601 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CUDA][HIP] warn incompatible redeclare (PR #77359)

2024-06-07 Thread Yaxun Liu via cfe-commits
@@ -9013,6 +9013,12 @@ def err_cuda_ovl_target : Error< "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">; def note_cuda_ovl_candidate_target_mismatch : Note< "candidate template ignored: target attributes do not match">; +def wa

[clang] [OpenMP] Fix passing target id features to AMDGPU offloading (PR #94765)

2024-06-07 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/94765 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CUDA][HIP] warn incompatible redeclare (PR #77359)

2024-06-07 Thread Yaxun Liu via cfe-commits
@@ -9013,6 +9013,12 @@ def err_cuda_ovl_target : Error< "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">; def note_cuda_ovl_candidate_target_mismatch : Note< "candidate template ignored: target attributes do not match">; +def wa

[clang] [llvm] [CUDA][HIP] warn incompatible redeclare (PR #77359)

2024-06-07 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu updated https://github.com/llvm/llvm-project/pull/77359 >From dd589653a94faba3a458134b5713a82886271c86 Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Thu, 30 May 2024 16:02:37 -0400 Subject: [PATCH] [CUDA][HIP] warn incompatible redeclare nvcc warns about th

[clang] [llvm] [CUDA][HIP] warn incompatible redeclare (PR #77359)

2024-06-07 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only \ +// RUN: -isystem %S/Inputs -verify %s +// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fsyntax-only \ +// RUN: -isystem %S/Inputs -fcuda-is-device -verify %s +// RUN: %clang_cc1 -triple x86_

[clang] [llvm] [CUDA][HIP] warn incompatible redeclare (PR #77359)

2024-06-07 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu updated https://github.com/llvm/llvm-project/pull/77359 >From dd589653a94faba3a458134b5713a82886271c86 Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Thu, 30 May 2024 16:02:37 -0400 Subject: [PATCH 1/2] [CUDA][HIP] warn incompatible redeclare nvcc warns abou

[clang] [llvm] [CUDA][HIP] warn incompatible redeclare (PR #77359)

2024-06-07 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu edited https://github.com/llvm/llvm-project/pull/77359 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [CUDA][HIP] warn incompatible redeclare (PR #77359)

2024-06-10 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu closed https://github.com/llvm/llvm-project/pull/77359 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][AMDGPU] Add a new builtin type for buffer rsrc (PR #94830)

2024-06-11 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: how does a user initialize/populate this type of objects? by calling a builtin function? need a SemaCUDA test to make sure it is defined with %clang_cc1 -triple x86_64-unknown-gnu-linux -aux-triple amdgcn-amd-amdhsa , like https://github.com/llvm/llvm-project/blob/main/clang/

[clang] [llvm] [clang][Driver] Add HIPAMD Driver support for AMDGCN flavoured SPIR-V (PR #95061)

2024-06-12 Thread Yaxun Liu via cfe-commits
@@ -128,12 +128,13 @@ enum class CudaArch { GFX12_GENERIC, GFX1200, GFX1201, + AMDGCNSPIRV, Generic, // A processor model named 'generic' if the target backend defines a // public one. LAST, CudaDefault = CudaArch::SM_52, - HIPDefault = CudaArch::

[clang] [Clang][AMDGPU] Add a new builtin type for buffer rsrc (PR #94830)

2024-06-12 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > > how does a user initialize/populate this type of objects? by calling a > > builtin function? > > yes. The builtin functions will come next. > > > need a SemaCUDA test to make sure it is defined with %clang_cc1 -triple > > x86_64-unknown-gnu-linux -aux-triple amdgcn-amd-amd

[clang] [Clang][AMDGPU] Add a builtin for llvm.amdgcn.make.buffer.rsrc intrinsic (PR #95276)

2024-06-12 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: I am wondering whether prefix the builtin type with `__amdgcn_` would be better since I envision risk of conflicting with reserved names of other compilers or standard libraries. https://github.com/llvm/llvm-project/pull/95276 ___ cfe

[clang] [Clang][AMDGPU] Add a builtin for llvm.amdgcn.make.buffer.rsrc intrinsic (PR #95276)

2024-06-12 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,95 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -cl-std=CL2.0 -target-cpu verde -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple

[clang] [Clang][AMDGPU] Add a builtin for llvm.amdgcn.make.buffer.rsrc intrinsic (PR #95276)

2024-06-12 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > > I am wondering whether prefix the builtin type with `__amdgcn_` would be > > better since I envision risk of conflicting with reserved names of other > > compilers or standard libraries. > > In the patch where the type was introduced we had a brief back-and-forth. I > chec

[clang] [Clang][AMDGPU] Add a builtin for llvm.amdgcn.make.buffer.rsrc intrinsic (PR #95276)

2024-06-12 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,95 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -cl-std=CL2.0 -target-cpu verde -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple

[clang] [Clang][AMDGPU] Add a new builtin type for buffer rsrc (PR #94830)

2024-06-13 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -x hip -aux-triple amdgcn-amd-amdhsa %s -fsyntax-only -verify + +#define __device__ __attribute__((device)) + +__device__ __amdgcn_buffer_rsrc_t test_buffer_rsrc_t_device() {} // expected-warning {{non-void fun

[clang] [Clang][AMDGPU] Add a new builtin type for buffer rsrc (PR #94830)

2024-06-17 Thread Yaxun Liu via cfe-commits
@@ -0,0 +1,19 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -fsyntax-only -verify -triple amdgcn -Wno-unused-value %s + yxsamliu wrote: Add a run line: // RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64 -aux-triple amdgcn -Wno-unused-value

[clang] [llvm] [clang][Driver] Add HIPAMD Driver support for AMDGCN flavoured SPIR-V (PR #95061)

2024-06-17 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. LGTM. Thanks https://github.com/llvm/llvm-project/pull/95061 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HIP][Clang][Sema] Fix crash when calling builtins with pointer arguments (PR #95957)

2024-06-18 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/95957 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] clang/AMDGPU: Emit atomicrmw from ds_fadd builtins (PR #95395)

2024-06-18 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: These builtins generate atomic instructions in IR but the builtin function name does not have atomic. Is that a concern? Should they be renamed with atomic in name? https://github.com/llvm/llvm-project/pull/95395 ___ cfe-commits maili

[clang] [Clang][AMDGPU] Add a new builtin type for buffer rsrc (PR #94830)

2024-06-18 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. LGTM. Thanks. https://github.com/llvm/llvm-project/pull/94830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][AMDGPU] Add a builtin for `llvm.amdgcn.make.buffer.rsrc` intrinsic (PR #95276)

2024-06-20 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/95276 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][AMDGPU] Add builtins for instrinsic `llvm.amdgcn.raw.buffer.store` (PR #94576)

2024-06-20 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: maybe add a test for non-constant offset? https://github.com/llvm/llvm-project/pull/94576 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Enable ASAN in amdgpu toolchain for OpenCL (PR #96262)

2024-06-20 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu created https://github.com/llvm/llvm-project/pull/96262 None >From 16659ca492234b234cc5da2f36563e1d8009620f Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Thu, 20 Jun 2024 21:00:58 -0400 Subject: [PATCH] Enable ASAN in amdgpu toolchain for OpenCL --- clang

[clang] [llvm] [mlir] [Clang][CodeGen] Start migrating away from assuming the Default AS is 0 (PR #88182)

2024-05-28 Thread Yaxun Liu via cfe-commits
@@ -368,7 +368,8 @@ CodeGenModule::CodeGenModule(ASTContext &C, IntTy = llvm::IntegerType::get(LLVMContext, C.getTargetInfo().getIntWidth()); IntPtrTy = llvm::IntegerType::get(LLVMContext, C.getTargetInfo().getMaxPointerWidth()); - Int8PtrTy = llvm::PointerType::get(LL

[clang] [clang][CodeGen] `used` globals && the payloads for global ctors & dtors are globals (PR #93601)

2024-05-28 Thread Yaxun Liu via cfe-commits
@@ -2047,9 +2047,9 @@ void CodeGenModule::EmitCtorList(CtorList &Fns, const char *GlobalName) { llvm::Type *CtorPFTy = llvm::PointerType::get(CtorFTy, TheModule.getDataLayout().getProgramAddressSpace()); - // Get the type of a ctor entry, { i32, void ()*, i8* }. + /

<    7   8   9   10   11   12   13   14   15   16   >