[clang] Enable unguarded availability diagnostic on instantiated template functions (PR #91699)

2024-06-05 Thread Chris B via cfe-commits
llvm-beanz wrote: @nico, am I correct to assume those aren't false positives, just a bunch of places that didn't warn before? https://github.com/llvm/llvm-project/pull/91699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

2024-06-05 Thread Chris B via cfe-commits
@@ -194,18 +194,20 @@ macro(add_clang_symlink name dest) endmacro() function(clang_target_link_libraries target type) - if (TARGET obj.${target}) -target_link_libraries(obj.${target} ${ARGN}) - endif() - get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY

[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

2024-06-05 Thread Chris B via cfe-commits
@@ -194,18 +194,20 @@ macro(add_clang_symlink name dest) endmacro() function(clang_target_link_libraries target type) - if (TARGET obj.${target}) -target_link_libraries(obj.${target} ${ARGN}) - endif() - get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY

[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

2024-06-05 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. I think dependencies for object libraries are implicitly `INTERAFCE`, but it might be nice to make that explicit. I know CMake complains if you mix and match implicit and explicit specification of linkage types. Otherwise LGTM.

[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

2024-06-05 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/93454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][cmake] Fixes for PGO builds when invoking ninja twice (PR #92591)

2024-06-05 Thread Chris B via cfe-commits
llvm-beanz wrote: LGTM. Sorry for the delay. https://github.com/llvm/llvm-project/pull/92591 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][cmake] Fixes for PGO builds when invoking ninja twice (PR #92591)

2024-06-05 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/92591 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] add loop unroll (PR #93879)

2024-06-03 Thread Chris B via cfe-commits
@@ -7401,7 +7495,8 @@ b for constant buffer views (CBV). Register space is specified in the format ``space[number]`` and defaults to ``space0`` if omitted. Here're resource binding examples with and without space: -.. code-block:: c++ + +.. code-block:: hlsl

[clang] [HLSL] add loop unroll (PR #93879)

2024-06-03 Thread Chris B via cfe-commits
llvm-beanz wrote: Can you also add some tests for nested loops? Cases like: ```hlsl [unroll] for( int i = 0; i < 100; ++i) { // unroll this for( int j = 0; j < 100; ++j) { // but not this } } ``` https://github.com/llvm/llvm-project/pull/93879

[clang] [HLSL] Use llvm::Triple::EnvironmentType instead of HLSLShaderAttr::ShaderType (PR #93847)

2024-05-30 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/93847 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Default and Relaxed Availability Diagnostics (PR #92704)

2024-05-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. I have one suggested code simplification which will also require test updates, but in general I think this is good. https://github.com/llvm/llvm-project/pull/92704 ___ cfe-commits mailing list

[clang] [HLSL] Default and Relaxed Availability Diagnostics (PR #92704)

2024-05-29 Thread Chris B via cfe-commits
@@ -1060,18 +1060,25 @@ static llvm::StringRef canonicalizePlatformName(llvm::StringRef Platform) { .Case("ShaderModel", "shadermodel") .Default(Platform); } -static llvm::StringRef getPrettyEnviromentName(llvm::StringRef Environment) { -return

[clang] [HLSL] Default and Relaxed Availability Diagnostics (PR #92704)

2024-05-23 Thread Chris B via cfe-commits
@@ -290,3 +294,295 @@ void SemaHLSL::DiagnoseAttrStageMismatch( << A << HLSLShaderAttr::ConvertShaderTypeToStr(Stage) << (AllowedStages.size() != 1) << join(StageStrings, ", "); } + +namespace { + +/// This class implements HLSL availability diagnostics for default

[clang] [HLSL] Default and Relaxed Availability Diagnostics (PR #92704)

2024-05-23 Thread Chris B via cfe-commits
@@ -290,3 +294,295 @@ void SemaHLSL::DiagnoseAttrStageMismatch( << A << HLSLShaderAttr::ConvertShaderTypeToStr(Stage) << (AllowedStages.size() != 1) << join(StageStrings, ", "); } + +namespace { + +/// This class implements HLSL availability diagnostics for default

[clang] [HLSL] Default and Relaxed Availability Diagnostics (PR #92704)

2024-05-23 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: Looks pretty good to me. A few nits that you can take or leave. The one real concern I have is that I actually don't like `getPrettyEnviromentName` being a string->string mapping. Is it possible to instead use the Triple environment enum?

[clang] [HLSL] Default and Relaxed Availability Diagnostics (PR #92704)

2024-05-23 Thread Chris B via cfe-commits
@@ -1068,11 +1068,37 @@ static llvm::StringRef getPrettyEnviromentName(llvm::StringRef Environment) { .Case("hull", "hull shader") .Case("domain", "domain shader") .Case("compute", "compute shader") + .Case("raygeneration",

[clang] [HLSL] Default and Relaxed Availability Diagnostics (PR #92704)

2024-05-23 Thread Chris B via cfe-commits
@@ -290,3 +294,295 @@ void SemaHLSL::DiagnoseAttrStageMismatch( << A << HLSLShaderAttr::ConvertShaderTypeToStr(Stage) << (AllowedStages.size() != 1) << join(StageStrings, ", "); } + +namespace { + +/// This class implements HLSL availability diagnostics for default

[clang] [HLSL] Default and Relaxed Availability Diagnostics (PR #92704)

2024-05-23 Thread Chris B via cfe-commits
@@ -290,3 +294,295 @@ void SemaHLSL::DiagnoseAttrStageMismatch( << A << HLSLShaderAttr::ConvertShaderTypeToStr(Stage) << (AllowedStages.size() != 1) << join(StageStrings, ", "); } + +namespace { + +/// This class implements HLSL availability diagnostics for default

[clang] [HLSL] Default and Relaxed Availability Diagnostics (PR #92704)

2024-05-23 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/92704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Enable unguarded availability diagnostic on instantiated template functions (PR #91699)

2024-05-23 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. We've waited a week on this PR to see if anyone from Apple will chime in. On previous PRs we waited weeks and got no response. We've reached out on Discord too. This PR looks sane to me and it seems to have adequate testing. I think we

[clang] [HLSL][CMake] Cache files don't have generator vars (PR #92793)

2024-05-20 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/92793 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][CMake] Cache files don't have generator vars (PR #92793)

2024-05-20 Thread Chris B via cfe-commits
llvm-beanz wrote: Merging before the PR bots finish since the PR bots don't actually use this file anyways... https://github.com/llvm/llvm-project/pull/92793 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [HLSL][CMake] Cache files don't have generator vars (PR #92793)

2024-05-20 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/92793 Doh! CMake cache scripts don't have generator variables set yet, so the script can't depend on the generator variables. Instead I've added a variable that a user can specify to enable the distribution

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-05-17 Thread Chris B via cfe-commits
llvm-beanz wrote: I think the different slice there is platform vs language. SemaHLSL should be where HLSL tests go regardless of platform (DirectX or Vulkan), but we should try to keep HLSL separate from C/C++ tests.

[clang] HLSL availability diagnostics design doc (PR #92207)

2024-05-17 Thread Chris B via cfe-commits
@@ -0,0 +1,139 @@ += +HLSL Availability Diagnostics += + +.. contents:: + :local: + +Introduction + + +HLSL availability diagnostics emits errors or warning when unavailable shader APIs are used. Unavailable

[clang] HLSL availability diagnostics design doc (PR #92207)

2024-05-17 Thread Chris B via cfe-commits
@@ -0,0 +1,139 @@ += +HLSL Availability Diagnostics += + +.. contents:: + :local: + +Introduction + + +HLSL availability diagnostics emits errors or warning when unavailable shader APIs are used. Unavailable

[clang] HLSL availability diagnostics design doc (PR #92207)

2024-05-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. A few small suggestions feel free to take them or leave them, otherwise looks good. https://github.com/llvm/llvm-project/pull/92207 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] HLSL availability diagnostics design doc (PR #92207)

2024-05-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/92207 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-05-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: A couple comments, but mostly this looks good to me. https://github.com/llvm/llvm-project/pull/89809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-05-17 Thread Chris B via cfe-commits
llvm-beanz wrote: nit: we've generally tried to keep the HLSL-specific tests separated from the other language tests (i.e. SemaHLSL). https://github.com/llvm/llvm-project/pull/89809 ___ cfe-commits mailing list

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-05-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/89809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][CMake] Add clangd and distribution settings (PR #92011)

2024-05-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/92011 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][CMake] Add clangd and distribution settings (PR #92011)

2024-05-17 Thread Chris B via cfe-commits
@@ -8,6 +8,12 @@ set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD "DirectX;SPIRV" CACHE STRING "") # HLSL support is currently limted to clang, eventually it will expand to # clang-tools-extra too. -set(LLVM_ENABLE_PROJECTS "clang" CACHE STRING "") +set(LLVM_ENABLE_PROJECTS

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-16 Thread Chris B via cfe-commits
llvm-beanz wrote: > This PR will not change this. The padding will only be added when required. _That's the problem_ > > ```hlsl > cbuffer { > float F; > float2 V; > } > ``` > > will still got > > ```llvm > type { float, <2 x float>} > ``` And there will implicitly be padding between

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-16 Thread Chris B via cfe-commits
llvm-beanz wrote: > You can use `type <{ float, <2 x float>}>` if you need the tightly-packed > layout. I think we need to figure out how we're going to lower this too. Loading from this memory space requires loading 128 bytes at a time, and we need to slice it down to just the parts of the

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-16 Thread Chris B via cfe-commits
llvm-beanz wrote: > Could you explain more about can't put any vectors or matrices into the > cbuffer structure type? Consider this example (regardless of packoffset): ```hlsl cbuffer { float F; float2 V; } ``` The layout for this is basically: ```c struct { float F; float Vx; // v.x

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-15 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: I'm a little concerned about the strategy here. LLVM generally doesn't explicitly capture padding it relies on the data layout rules to capture that. If this is the approach we're going with you can't put any vectors or matrices into the cbuffer

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-15 Thread Chris B via cfe-commits
@@ -5671,6 +5671,54 @@ HLSLBufferDecl *HLSLBufferDecl::CreateDeserialized(ASTContext , SourceLocation(), SourceLocation()); } +static uint64_t calculateLegacyCbufferAlign(const ASTContext , +

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-05-14 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: Overall this looks good to me. One set of suggestions inline. https://github.com/llvm/llvm-project/pull/89809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-05-14 Thread Chris B via cfe-commits
@@ -772,40 +816,58 @@ void DiagnoseUnguardedAvailability::DiagnoseDeclAvailability( const AvailabilityAttr *AA = getAttrForPlatform(SemaRef.getASTContext(), OffendingDecl); +bool EnvironmentMatchesOrNone = +

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-05-14 Thread Chris B via cfe-commits
@@ -376,26 +400,46 @@ static void DoEmitAvailabilityWarning(Sema , AvailabilityResult K, // not specified for deployment targets >= to iOS 11 or equivalent or // for declarations that were introduced in iOS 11 (macOS 10.13, ...) or // later. -const

[clang] [HLSL][CMake] Add clangd and distribution settings (PR #92011)

2024-05-13 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/92011 >From e1b82c5bb1869ac74080e17633bd8ac7931a47b6 Mon Sep 17 00:00:00 2001 From: Chris B Date: Mon, 13 May 2024 13:55:49 -0500 Subject: [PATCH 1/2] [HLSL][CMake] Add clangd and distribution settings This just

[clang] [HLSL][CMake] Add clangd and distribution settings (PR #92011)

2024-05-13 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/92011 This just adds some simple distribution settings and includes clangd in the build for distribution. >From e1b82c5bb1869ac74080e17633bd8ac7931a47b6 Mon Sep 17 00:00:00 2001 From: Chris B Date: Mon, 13 May

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-07 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/89836 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-07 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/89836 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-07 Thread Chris B via cfe-commits
@@ -4372,6 +4372,13 @@ def HLSLResourceBinding: InheritableAttr { let Documentation = [HLSLResourceBindingDocs]; } +def HLSLPackOffset: HLSLAnnotationAttr { + let Spellings = [HLSLAnnotation<"packoffset">]; + let LangOpts = [HLSL]; + let Args = [IntArgument<"Offset">];

[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)

2024-05-07 Thread Chris B via cfe-commits
@@ -1206,6 +1233,47 @@ std::string Triple::normalize(StringRef Str) { } } + // Normalize DXIL triple if it does not include DXIL version number. + // Determine DXIL version number using the minor version number of Shader + // Model version specified in target triple,

[clang] [HLSL] Implement 202x conforming literals (PR #91015)

2024-05-06 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/91015 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)

2024-05-06 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/90809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement 202x conforming literals (PR #91015)

2024-05-03 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/91015 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement 202x conforming literals (PR #91015)

2024-05-03 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/91015 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement 202x conforming literals (PR #91015)

2024-05-03 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/91015 This implements the HLSL 202x conforming literals feature. The feature proposal is available here: https://github.com/microsoft/hlsl-specs/blob/main/proposals/0017-conform ing-literals.md The language

[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)

2024-05-03 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: Given that @bogner had concerns about the other approach I think we should get him to review this before moving forward. That said, other than some missing unit test coverage I think this approach looks fine.

[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)

2024-05-03 Thread Chris B via cfe-commits
@@ -1200,6 +1224,27 @@ std::string Triple::normalize(StringRef Str) { } } + // Normalize DXIL triple if it does not include DXIL version number. + // Determine DXIL version number using the minor version number of Shader + // Model version specified in target triple,

[clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-05-03 Thread Chris B via cfe-commits
llvm-beanz wrote: > I don't know if the pre-commit testing guarantees that. Configuration > settings will permit the files to be checked out in either Unix (`\n`) or > Windows (`\r\n`) line-endings. Today on Windows you basically have to check out LLVM as unix line endings. There are a

[clang] [HLSL] Cleanup TargetInfo handling (PR #90694)

2024-05-02 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/90694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Shore up floating point conversions (PR #90222)

2024-05-02 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/90222 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Chris B via cfe-commits
https://github.com/llvm-beanz requested changes to this pull request. I'm marking this as requesting changes because I don't think we should land this as-is. https://github.com/llvm/llvm-project/pull/89836 ___ cfe-commits mailing list

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Chris B via cfe-commits
@@ -108,3 +108,18 @@ behavior between Clang and DXC. Some examples include: diagnostic notifying the user of the conversion rather than silently altering precision relative to the other overloads (as FXC does) or generating code that will fail validation (as DXC does). +

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Chris B via cfe-commits
@@ -4372,6 +4372,13 @@ def HLSLResourceBinding: InheritableAttr { let Documentation = [HLSLResourceBindingDocs]; } +def HLSLPackOffset: HLSLAnnotationAttr { + let Spellings = [HLSLAnnotation<"packoffset">]; + let LangOpts = [HLSL]; + let Args = [IntArgument<"Offset">];

[clang] [HLSL] Shore up floating point conversions (PR #90222)

2024-05-01 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/90222 >From a173605b6043739e69f89d3a559a4f6a68d5fc0a Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 25 Apr 2024 15:47:22 -0500 Subject: [PATCH 1/2] [HLSL] Shore up floating point conversions This PR

[clang] [HLSL] Shore up floating point conversions (PR #90222)

2024-05-01 Thread Chris B via cfe-commits
@@ -0,0 +1,229 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -Wconversion -verify -o - %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -ast-dump %s | FileCheck

[clang] [HLSL] Shore up floating point conversions (PR #90222)

2024-05-01 Thread Chris B via cfe-commits
@@ -4393,6 +4401,24 @@ getFixedEnumPromtion(Sema , const StandardConversionSequence ) { return FixedEnumPromotion::ToPromotedUnderlyingType; } +static ImplicitConversionSequence::CompareKind +HLSLCompareFloatingRank(QualType LHS, QualType RHS) { +

[clang] [HLSL] Shore up floating point conversions (PR #90222)

2024-05-01 Thread Chris B via cfe-commits
@@ -2616,6 +2617,13 @@ bool Sema::IsFloatingPointPromotion(QualType FromType, QualType ToType) { ToBuiltin->getKind() == BuiltinType::Ibm128)) return true; + // In HLSL, `half` promotes to `float` or `double`, regardless of whether + // or not

[clang] [HLSL] Shore up floating point conversions (PR #90222)

2024-05-01 Thread Chris B via cfe-commits
@@ -0,0 +1,229 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -Wconversion -verify -o - %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -ast-dump %s | FileCheck

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Chris B via cfe-commits
@@ -4372,6 +4372,13 @@ def HLSLResourceBinding: InheritableAttr { let Documentation = [HLSLResourceBindingDocs]; } +def HLSLPackOffset: HLSLAnnotationAttr { + let Spellings = [HLSLAnnotation<"packoffset">]; + let LangOpts = [HLSL]; + let Args = [IntArgument<"Offset">];

[clang] [HLSL] Cleanup TargetInfo handling (PR #90694)

2024-05-01 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/90694 >From 2464bcb75b047c49076f0718470f27a561252a62 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Tue, 30 Apr 2024 20:49:35 -0500 Subject: [PATCH 1/2] [NFC][HLSL] Cleanup TargetInfo handling We had some odd

[clang] [HLSL] Cleanup TargetInfo handling (PR #90694)

2024-05-01 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/90694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Cleanup TargetInfo handling (PR #90694)

2024-05-01 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/90694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][HLSL] Cleanup TargetInfo handling (PR #90694)

2024-05-01 Thread Chris B via cfe-commits
@@ -406,6 +406,16 @@ void TargetInfo::adjust(DiagnosticsEngine , LangOptions ) { LongDoubleAlign = 64; } + // HLSL explicitly defines the sizes and formats of some data types, and we + // need to conform to those regardless of what architecture you are targeting. +

[clang] [NFC][HLSL] Cleanup TargetInfo handling (PR #90694)

2024-05-01 Thread Chris B via cfe-commits
@@ -1612,15 +1612,7 @@ const llvm::fltSemantics ::getFloatTypeSemantics(QualType T) const { case BuiltinType::Float16: return Target->getHalfFormat(); case BuiltinType::Half: -// For HLSL, when the native half type is disabled, half will be treat as -// float.

[clang] [llvm] [Pipelines] Do not run CoroSplit and CoroCleanup in LTO pre-link pipeline (PR #90310)

2024-05-01 Thread Chris B via cfe-commits
@@ -0,0 +1,77 @@ +// This tests that the coroutine elide optimization could happen succesfully with ThinLTO. +// This test is adapted from coro-elide.cpp and splits functions into two files. +// +// RUN: split-file %s %t +// RUN: %clang --target=x86_64-linux -std=c++20 -O2

[clang] [NFC][HLSL] Cleanup TargetInfo handling (PR #90694)

2024-04-30 Thread Chris B via cfe-commits
@@ -406,6 +406,16 @@ void TargetInfo::adjust(DiagnosticsEngine , LangOptions ) { LongDoubleAlign = 64; } + // HLSL explicitly defines the sizes and formats of some data types, and we + // need to conform to those regardless of what architecture you are targeting. +

[clang] [NFC][HLSL] Cleanup TargetInfo handling (PR #90694)

2024-04-30 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/90694 We had some odd places where we set target behaviors. We were setting the long size in target-specific code, but it should be language-based. We were not setting the Half float type semantics correctly, and

[clang] [llvm] [Pipelines] Do not run CoroSplit and CoroCleanup in LTO pre-link pipeline (PR #90310)

2024-04-30 Thread Chris B via cfe-commits
@@ -0,0 +1,77 @@ +// This tests that the coroutine elide optimization could happen succesfully with ThinLTO. +// This test is adapted from coro-elide.cpp and splits functions into two files. +// +// RUN: split-file %s %t +// RUN: %clang --target=x86_64-linux -std=c++20 -O2

[clang] [HLSL] Shore up floating point conversions (PR #90222)

2024-04-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/90222 >From a173605b6043739e69f89d3a559a4f6a68d5fc0a Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 25 Apr 2024 15:47:22 -0500 Subject: [PATCH] [HLSL] Shore up floating point conversions This PR fixes

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-29 Thread Chris B via cfe-commits
@@ -7314,6 +7314,41 @@ static void handleHLSLSV_DispatchThreadIDAttr(Sema , Decl *D, D->addAttr(::new (S.Context) HLSLSV_DispatchThreadIDAttr(S.Context, AL)); } +static void handleHLSLPackOffsetAttr(Sema , Decl *D, const ParsedAttr ) { + if (!isa(D) ||

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-29 Thread Chris B via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -triple dxil-unknown-shadermodel6.3-library -S -finclude-default-header -ast-dump -x hlsl %s | FileCheck %s + + +// CHECK: HLSLBufferDecl {{.*}} cbuffer A +cbuffer A +{ +// CHECK-NEXT: VarDecl {{.*}} C1 'float4'

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-29 Thread Chris B via cfe-commits
@@ -183,6 +183,86 @@ void Parser::ParseHLSLAnnotations(ParsedAttributes , return; } } break; + case ParsedAttr::AT_HLSLPackOffset: { +// Parse 'packoffset( c[Subcomponent][.component] )'. +// Check '('. +if (ExpectAndConsume(tok::l_paren,

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-29 Thread Chris B via cfe-commits
@@ -0,0 +1,55 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library -verify %s + +// expected-error@+1{{cannot mix packoffset elements with nonpackoffset elements in a cbuffer}} +cbuffer Mix +{ +float4 M1 : packoffset(c0); +float M2; +

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-29 Thread Chris B via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -triple dxil-unknown-shadermodel6.3-library -S -finclude-default-header -ast-dump -x hlsl %s | FileCheck %s + + +// CHECK: HLSLBufferDecl {{.*}} cbuffer A +cbuffer A +{ +// CHECK-NEXT: VarDecl {{.*}} C1 'float4' +// CHECK-NEXT:

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-29 Thread Chris B via cfe-commits
@@ -7398,6 +7398,26 @@ The full documentation is available here: https://docs.microsoft.com/en-us/windo }]; } +def HLSLPackOffsetDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +The packoffset attribute is used to change the layout of a

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-04-29 Thread Chris B via cfe-commits
llvm-beanz wrote: > While I like the approach of aligning availability parameters closer to > `llvm::Triple`, I am concerned about how this will interact with existing > precedent. There is a lot of code that passes in _platform_ values that > aren't actually `OSType`. For example >

[clang] [HLSL] Shore up floating point conversions (PR #90222)

2024-04-26 Thread Chris B via cfe-commits
@@ -0,0 +1,229 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -Wconversion -verify -o - %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -ast-dump %s | FileCheck

[clang] [HLSL] Shore up floating point conversions (PR #90222)

2024-04-26 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/90222 This PR fixes bugs in HLSL floating conversions. HLSL always has `half`, `float` and `double` types, which promote in the order: `half`->`float`->`double` and convert in the order:

[clang] [llvm] [DXIL] implement dot intrinsic lowering for integers (PR #85662)

2024-04-26 Thread Chris B via cfe-commits
@@ -39,11 +39,44 @@ static bool isIntrinsicExpansion(Function ) { case Intrinsic::dx_uclamp: case Intrinsic::dx_lerp: case Intrinsic::dx_rcp: + case Intrinsic::dx_sdot: + case Intrinsic::dx_udot: return true; } return false; } +static bool

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-04-25 Thread Chris B via cfe-commits
@@ -3859,7 +3862,7 @@ def warn_availability_fuchsia_unavailable_minor : Warning< InGroup; def warn_unguarded_availability : - Warning<"%0 is only available on %1 %2 or newer">, + Warning<"%0 %select{is only|is not}5 available %select{|in %4 environment }3on %1 %2

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-04-25 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/89809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-04-25 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: Overall I really like the direction of this. I'm curious if any of the maintainers from Apple have thoughts since they're the primary users of availability annotations. I think this dramatically simplifies things for what we need, but it might also

[clang] [HLSL] Correctly set `__HLSL_ENABLE_16_BIT` (PR #89788)

2024-04-25 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/89788 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-24 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/89823 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-24 Thread Chris B via cfe-commits
@@ -68,25 +68,25 @@ TEST(DxcModeTest, TargetProfileValidation) { IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions(); DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagConsumer); - validateTargetProfile("-Tvs_6_0", "dxil--shadermodel6.0-vertex", +

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-24 Thread Chris B via cfe-commits
@@ -68,25 +68,25 @@ TEST(DxcModeTest, TargetProfileValidation) { IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions(); DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagConsumer); - validateTargetProfile("-Tvs_6_0", "dxil--shadermodel6.0-vertex", +

[clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-04-24 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. I'm happy with this approach. We can adjust and iteratively address issues if any appear. https://github.com/llvm/llvm-project/pull/86318 ___ cfe-commits mailing list

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-23 Thread Chris B via cfe-commits
@@ -68,25 +68,25 @@ TEST(DxcModeTest, TargetProfileValidation) { IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions(); DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagConsumer); - validateTargetProfile("-Tvs_6_0", "dxil--shadermodel6.0-vertex", +

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-23 Thread Chris B via cfe-commits
@@ -98,9 +106,46 @@ std::optional tryParseProfile(StringRef Profile) { else if (llvm::getAsUnsignedInteger(Parts[2], 0, Minor)) return std::nullopt; - // dxil-unknown-shadermodel-hull + // Determine DXIL version number using the minor version number of Shader + //

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-23 Thread Chris B via cfe-commits
@@ -12,7 +12,10 @@ #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Job.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/TargetParser/Triple.h" +#include +#include llvm-beanz wrote: Do we need ?

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-23 Thread Chris B via cfe-commits
@@ -35,6 +38,11 @@ bool isLegalShaderModel(Triple ) { if (Version.getSubminor()) return false; + // DXIL Version should be set as SubArch + if (T.getSubArch() == Triple::NoSubArch) { +return false; + } llvm-beanz wrote: nit: ```suggestion if

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-23 Thread Chris B via cfe-commits
@@ -12,7 +12,10 @@ #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Job.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/Support/ErrorHandling.h" llvm-beanz wrote: This header should not be needed.

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-23 Thread Chris B via cfe-commits
@@ -98,9 +100,47 @@ std::optional tryParseProfile(StringRef Profile) { else if (llvm::getAsUnsignedInteger(Parts[2], 0, Minor)) return std::nullopt; - // dxil-unknown-shadermodel-hull + // Determine DXIL version number using the minor version number of Shader + //

  1   2   3   4   >