@@ -22,56 +22,144 @@
//
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
-// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
+// RUN: -emit-llvm -o - | FileCheck %s \
// RUN: -DFNATTRS
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/130320
>From bdb66b5a68090e304647ddbbeb403ac408fcea65 Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Tue, 25 Feb 2025 14:50:09 -0800
Subject: [PATCH 1/8] start implementation
---
clang/lib/Headers/hlsl/hlsl_detail.h | 14
@@ -22,56 +22,144 @@
//
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
-// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
+// RUN: -emit-llvm -o - | FileCheck %s \
// RUN: -DFNATTRS
https://github.com/kmpeng created
https://github.com/llvm/llvm-project/pull/130320
Replaced the current `fmod` definition with a templatized version, implemented
`fmod` algorithm for DirectX targets that matches the DXC implementation, added
corresponding tests in `clang/test/CodeGenHLSL/built
@@ -22,56 +22,144 @@
//
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
-// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
+// RUN: -emit-llvm -o - | FileCheck %s \
// RUN: -DFNATTRS
@@ -22,56 +22,136 @@
//
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
-// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
-// RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTY
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/130320
>From bdb66b5a68090e304647ddbbeb403ac408fcea65 Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Tue, 25 Feb 2025 14:50:09 -0800
Subject: [PATCH 1/9] start implementation
---
clang/lib/Headers/hlsl/hlsl_detail.h | 14
@@ -22,56 +22,144 @@
//
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
-// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
+// RUN: -emit-llvm -o - | FileCheck %s \
// RUN: -DFNATTRS
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/130320
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -22,56 +22,144 @@
//
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
-// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
+// RUN: -emit-llvm -o - | FileCheck %s \
// RUN: -DFNATTRS
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/130320
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/130320
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -22,56 +22,136 @@
//
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
-// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
-// RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTY
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/130320
>From fd3db87977a52d7560d9eec15522c8afb85c9171 Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Tue, 25 Feb 2025 14:50:09 -0800
Subject: [PATCH 01/10] start implementation
---
clang/lib/Headers/hlsl/hlsl_detail.h |
https://github.com/kmpeng created
https://github.com/llvm/llvm-project/pull/131035
Fixes #131024.
- Fixes template for scalar and vector `fmod` intrinsic overloads
- Fixes `fmod` Sema test
>From b33ab9d6a3c87c59ca9b2d3e8e5001f1d79bb620 Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Tue, 11 Mar 20
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/131035
>From 72625f987846d33c11e57ec4e42e98bf211f3389 Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Tue, 11 Mar 2025 16:47:27 -0700
Subject: [PATCH] add bounds checks for the hlsl fmod vector arguments and
return types
https://github.com/kmpeng deleted
https://github.com/llvm/llvm-project/pull/132288
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng created
https://github.com/llvm/llvm-project/pull/132288
Closes #99156.
Tasks completed:
- Implement `smoothstep` using HLSL source in `hlsl_intrinsics.h`
- Implement the `smoothstep` SPIR-V target built-in in
`clang/include/clang/Basic/BuiltinsSPIRV.td`
- Add sema c
@@ -101,6 +101,44 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned
BuiltinID,
TheCall->setType(RetTy);
break;
}
+ case SPIRV::BI__builtin_spirv_smoothstep: {
+if (SemaRef.checkArgCount(TheCall, 3))
+ return true;
+
+ExprResult A = TheCall->getA
@@ -0,0 +1,44 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
UTC_ARGS: --version 5
+
+// RUN: %clang_cc1 -O1 -triple spirv-pc-vulkan-compute %s -emit-llvm -o - |
FileCheck %s
+
+typedef float float2 __attribute__((ext_vector_type(2)));
+typedef
@@ -101,6 +101,44 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned
BuiltinID,
TheCall->setType(RetTy);
break;
}
+ case SPIRV::BI__builtin_spirv_smoothstep: {
+if (SemaRef.checkArgCount(TheCall, 3))
+ return true;
+
+ExprResult A = TheCall->getA
https://github.com/kmpeng deleted
https://github.com/llvm/llvm-project/pull/132288
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/132288
>From 0a5da660c5aae053d87d556e59f98c121d916b79 Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Tue, 18 Mar 2025 13:25:10 -0700
Subject: [PATCH 1/6] create int_spv_smoothstep intrinsic, create smoothstep
lowering & m
@@ -20955,6 +20955,25 @@ Value *CodeGenFunction::EmitSPIRVBuiltinExpr(unsigned
BuiltinID,
/*ReturnType=*/I->getType(), Intrinsic::spv_reflect,
ArrayRef{I, N}, nullptr, "spv.reflect");
}
+ case SPIRV::BI__builtin_spirv_smoothstep: {
+Value *Min = EmitScal
@@ -20955,6 +20955,25 @@ Value *CodeGenFunction::EmitSPIRVBuiltinExpr(unsigned
BuiltinID,
/*ReturnType=*/I->getType(), Intrinsic::spv_reflect,
ArrayRef{I, N}, nullptr, "spv.reflect");
}
+ case SPIRV::BI__builtin_spirv_smoothstep: {
+Value *Min = EmitScal
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/134171
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 %s -triple spirv-pc-vulkan-compute -verify
+
+typedef float float2 __attribute__((ext_vector_type(2)));
+
+float2 test_no_second_arg(float2 p0) {
+ return __builtin_spirv_smoothstep(p0);
+ // expected-error@-1 {{too few arguments to function
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/132288
>From 0a5da660c5aae053d87d556e59f98c121d916b79 Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Tue, 18 Mar 2025 13:25:10 -0700
Subject: [PATCH 1/7] create int_spv_smoothstep intrinsic, create smoothstep
lowering & m
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/134171
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng created
https://github.com/llvm/llvm-project/pull/134171
Closes #99135.
Tasks completed:
- Wrote implementation in `hlsl_intrinsics.h`/`hlsl_intrinsic_helpers.h` that
matches DXC
- Created overloads in `hlsl_compat_overloads.h` that take doubles/ints and
explicitly
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/134171
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/134171
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng deleted
https://github.com/llvm/llvm-project/pull/134171
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -280,6 +280,22 @@ constexpr bool4 isinf(double4 V) { return
isinf((float4)V); }
_DXC_COMPAT_TERNARY_DOUBLE_OVERLOADS(lerp)
_DXC_COMPAT_TERNARY_INTEGER_OVERLOADS(lerp)
+//===--===//
+// lit builtins overloa
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/134171
>From 719bb94279f64f134c826faa22898e4e549bb23c Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Thu, 27 Mar 2025 14:39:27 -0700
Subject: [PATCH 1/7] finished lit implementation, added codegen and sema tests
---
.../
@@ -253,6 +253,37 @@ const inline float
length(__detail::HLSL_FIXED_VECTOR X) {
return __detail::length_vec_impl(X);
}
+//===--===//
+// lit builtins
+//===--
@@ -0,0 +1,36 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
UTC_ARGS: --version 5
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple
dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - |
FileCheck %s
+
+// CHECK
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/134171
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/134171
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -101,6 +101,16 @@ constexpr vector smoothstep_vec_impl(vector
Min, vector Max,
#endif
}
+template constexpr vector lit_impl(T NDotL, T NDotH, T M) {
+ bool DiffuseCond = NDotL < 0;
+ T Diffuse = select(DiffuseCond, 0, NDotL);
+ vector Result = {1, Diffuse, 0, 1};
+ bo
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/134171
>From 719bb94279f64f134c826faa22898e4e549bb23c Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Thu, 27 Mar 2025 14:39:27 -0700
Subject: [PATCH 1/9] finished lit implementation, added codegen and sema tests
---
.../
@@ -253,6 +253,37 @@ const inline float
length(__detail::HLSL_FIXED_VECTOR X) {
return __detail::length_vec_impl(X);
}
+//===--===//
+// lit builtins
+//===--
@@ -280,6 +280,22 @@ constexpr bool4 isinf(double4 V) { return
isinf((float4)V); }
_DXC_COMPAT_TERNARY_DOUBLE_OVERLOADS(lerp)
_DXC_COMPAT_TERNARY_INTEGER_OVERLOADS(lerp)
+//===--===//
+// lit builtins overloa
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/134171
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -280,6 +280,22 @@ constexpr bool4 isinf(double4 V) { return
isinf((float4)V); }
_DXC_COMPAT_TERNARY_DOUBLE_OVERLOADS(lerp)
_DXC_COMPAT_TERNARY_INTEGER_OVERLOADS(lerp)
+//===--===//
+// lit builtins overloa
@@ -101,6 +101,52 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned
BuiltinID,
TheCall->setType(RetTy);
break;
}
+ case SPIRV::BI__builtin_spirv_smoothstep: {
+if (SemaRef.checkArgCount(TheCall, 3))
+ return true;
+
+// check if the all argument
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/132288
>From 0a5da660c5aae053d87d556e59f98c121d916b79 Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Tue, 18 Mar 2025 13:25:10 -0700
Subject: [PATCH 1/8] create int_spv_smoothstep intrinsic, create smoothstep
lowering & m
@@ -0,0 +1,183 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
UTC_ARGS: --version 5
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
+// RUN: -emit-llvm -O1 -o - |
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/132288
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -101,6 +101,52 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned
BuiltinID,
TheCall->setType(RetTy);
break;
}
+ case SPIRV::BI__builtin_spirv_smoothstep: {
+if (SemaRef.checkArgCount(TheCall, 3))
+ return true;
+
+// check if the all argument
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/132288
>From 0a5da660c5aae053d87d556e59f98c121d916b79 Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Tue, 18 Mar 2025 13:25:10 -0700
Subject: [PATCH 1/7] create int_spv_smoothstep intrinsic, create smoothstep
lowering & m
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/132288
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/132288
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng deleted
https://github.com/llvm/llvm-project/pull/132288
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,60 @@
+; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - |
FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o -
-filetype=obj | spirv-val %}
kmpeng wrote:
Seems like this change produces thi
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/132288
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/132288
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/132288
>From 1d28510653b39fcabe45ad37197674bdd0217add Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Tue, 18 Mar 2025 13:25:10 -0700
Subject: [PATCH 01/10] create int_spv_smoothstep intrinsic, create smoothstep
lowering &
@@ -0,0 +1,60 @@
+; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - |
FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o -
-filetype=obj | spirv-val %}
kmpeng wrote:
Code updated with `--target-env vul
@@ -101,6 +101,52 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned
BuiltinID,
TheCall->setType(RetTy);
break;
}
+ case SPIRV::BI__builtin_spirv_smoothstep: {
+if (SemaRef.checkArgCount(TheCall, 3))
+ return true;
+
+// check if the all argument
@@ -0,0 +1,60 @@
+; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - |
FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o -
-filetype=obj | spirv-val %}
kmpeng wrote:
Would you also like this added to t
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/132288
>From 7853b27b8fffa6d2c0393a4004abaac9a7954608 Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Tue, 18 Mar 2025 13:25:10 -0700
Subject: [PATCH 01/10] create int_spv_smoothstep intrinsic, create smoothstep
lowering &
@@ -101,6 +101,52 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned
BuiltinID,
TheCall->setType(RetTy);
break;
}
+ case SPIRV::BI__builtin_spirv_smoothstep: {
+if (SemaRef.checkArgCount(TheCall, 3))
+ return true;
+
+// check if the all argument
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/132288
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/132288
>From 7853b27b8fffa6d2c0393a4004abaac9a7954608 Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Tue, 18 Mar 2025 13:25:10 -0700
Subject: [PATCH 1/8] create int_spv_smoothstep intrinsic, create smoothstep
lowering & m
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/132288
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,60 @@
+; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - |
FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o -
-filetype=obj | spirv-val %}
kmpeng wrote:
@s-perron Changing the target envir
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/132288
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/132288
>From 1d28510653b39fcabe45ad37197674bdd0217add Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Tue, 18 Mar 2025 13:25:10 -0700
Subject: [PATCH 01/11] create int_spv_smoothstep intrinsic, create smoothstep
lowering &
https://github.com/kmpeng updated
https://github.com/llvm/llvm-project/pull/134171
>From 719bb94279f64f134c826faa22898e4e549bb23c Mon Sep 17 00:00:00 2001
From: kmpeng
Date: Thu, 27 Mar 2025 14:39:27 -0700
Subject: [PATCH 1/8] finished lit implementation, added codegen and sema tests
---
.../
@@ -322,5 +322,53 @@ reflect(__detail::HLSL_FIXED_VECTOR I,
__detail::HLSL_FIXED_VECTOR N) {
return __detail::reflect_vec_impl(I, N);
}
+
+//===--===//
+// smoothstep builtin
+//===---
@@ -253,6 +253,37 @@ const inline float
length(__detail::HLSL_FIXED_VECTOR X) {
return __detail::length_vec_impl(X);
}
+//===--===//
+// lit builtins
+//===--
@@ -101,6 +101,16 @@ constexpr vector smoothstep_vec_impl(vector
Min, vector Max,
#endif
}
+template constexpr vector lit_impl(T NDotL, T NDotH, T M) {
+ bool DiffuseCond = NDotL < 0;
+ T Diffuse = select(DiffuseCond, 0, NDotL);
+ vector Result = {1, Diffuse, 0, 1};
+ bo
kmpeng wrote:
I currently don't have `-fnative-half-type` enabled in that file, so yes this
test case ends up having `float` input/return types (though it's not
necessarily being converted in the function, if that's what you're asking).
With `-fnative-half-ty
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/134171
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/134171
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/kmpeng edited
https://github.com/llvm/llvm-project/pull/134171
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
77 matches
Mail list logo