Skip to content

Commit 2eb7ea0

Browse files
committed
Merge branch 'feature/checkcrt' of https://github.com/quesswho/slang into feature/checkcrt
2 parents d74e522 + 36b03ec commit 2eb7ea0

21 files changed

+590
-34
lines changed

.github/workflows/ci-slang-build-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
contents: read
2121
packages: read # Required to pull container from ghcr.io
2222
container:
23-
image: ghcr.io/shader-slang/slang-linux-gpu-ci:v1.3.0
23+
image: ghcr.io/shader-slang/slang-linux-gpu-ci:v1.4.0
2424
options: --user root -v /:/host_root
2525

2626
env:

.github/workflows/ci-slang-test-container.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
packages: read
2828

2929
container:
30-
image: ghcr.io/shader-slang/slang-linux-gpu-ci:v1.3.0
30+
image: ghcr.io/shader-slang/slang-linux-gpu-ci:v1.4.0
3131
credentials:
3232
username: ${{ github.actor }}
3333
password: ${{ secrets.GITHUB_TOKEN }}
@@ -142,7 +142,7 @@ jobs:
142142
packages: read
143143

144144
container:
145-
image: ghcr.io/shader-slang/slang-linux-gpu-ci:v1.3.0
145+
image: ghcr.io/shader-slang/slang-linux-gpu-ci:v1.4.0
146146
credentials:
147147
username: ${{ github.actor }}
148148
password: ${{ secrets.GITHUB_TOKEN }}
@@ -225,7 +225,7 @@ jobs:
225225
packages: read
226226

227227
container:
228-
image: ghcr.io/shader-slang/slang-linux-gpu-ci:v1.3.0
228+
image: ghcr.io/shader-slang/slang-linux-gpu-ci:v1.4.0
229229
credentials:
230230
username: ${{ github.actor }}
231231
password: ${{ secrets.GITHUB_TOKEN }}

cmake/CheckSecureCRT.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ slang_probe_symbol_call(HAVE_WCSNCPY_S
4646
slang_probe_symbol_call(HAVE_STRNCPY_S
4747
"char b[1]; strncpy_s(b, 1, \"x\", 1)"
4848
"string.h")
49+

cmake/CompilerFlags.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ function(set_default_compile_options target)
221221
-fsanitize=address
222222
-fsanitize=undefined
223223
-fno-sanitize-recover=undefined
224+
-fsanitize-ignorelist=${PROJECT_SOURCE_DIR}/cmake/sanitizer-ignorelist.txt
224225
)
225226
target_link_options(
226227
${target}

cmake/SlangTarget.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,6 @@ function(slang_add_target dir type)
563563
)
564564
endif()
565565

566-
567566
#
568567
# Precompiled headers (PCH)
569568
#

cmake/sanitizer-ignorelist.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# UBSan ignorelist for prebuilt slang-llvm shared library.
2+
#
3+
# The prebuilt libslang-llvm is not compiled with sanitizers, so UBSan's
4+
# vptr checker cannot validate vtables from objects created inside it.
5+
# This causes false-positive "invalid vptr" aborts when sanitized code
6+
# calls virtual methods on ILLVMBuilder (a COM interface returned by the
7+
# non-instrumented library).
8+
#
9+
# Skip vptr checks for COM interfaces whose implementation lives in slang-llvm.
10+
# The type: pattern suppresses checks at all call sites regardless of which
11+
# source file the virtual call is in (e.g. slang-emit-llvm.cpp, slang-emit.cpp).
12+
[vptr]
13+
type:*ILLVMBuilder*

docker/linux-gpu-ci.Dockerfile

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
# Used by:
77
# - .github/workflows/ci-slang-build-container.yml
88
# - .github/workflows/ci-slang-test-container.yml
9-
# - .github/workflows/copilot-setup-steps.yml
109
#
1110
# Build and push:
12-
# docker build -f docker/linux-gpu-ci.Dockerfile -t ghcr.io/shader-slang/slang-linux-gpu-ci:v1.3.0 .
13-
# docker push ghcr.io/shader-slang/slang-linux-gpu-ci:v1.3.0
11+
# docker build -f docker/linux-gpu-ci.Dockerfile -t ghcr.io/shader-slang/slang-linux-gpu-ci:v1.4.0 .
12+
# docker push ghcr.io/shader-slang/slang-linux-gpu-ci:v1.4.0
1413
#
1514
# IMPORTANT: After pushing a new version, update all references in:
1615
# - .github/workflows/ci-slang-build-container.yml
@@ -24,8 +23,8 @@
2423

2524
FROM nvidia/cuda:13.0.1-devel-ubuntu22.04
2625

27-
# Install essential tools required for GitHub Actions and Copilot
28-
# - curl: for downloading Copilot runtime and dependencies
26+
# Install essential tools required for GitHub Actions
27+
# - curl: for downloading dependencies
2928
# - wget: for downloading CMake and other tools
3029
# - git: for repository operations and submodules
3130
# - tar, gzip: for archive extraction
@@ -58,18 +57,18 @@ RUN apt-get update && apt-get install -y \
5857
glslang-tools \
5958
&& rm -rf /var/lib/apt/lists/*
6059

61-
# Install Vulkan SDK 1.4.321.1 from tarball (apt packages discontinued after 1.4.313)
60+
# Install Vulkan SDK 1.4.341.1 from tarball (apt packages discontinued after 1.4.313)
6261
# Using tarball to get the fixed validation layers that resolve cooperative vector issues
63-
ENV VULKAN_SDK=/opt/vulkan-sdk/1.4.321.1/x86_64
62+
ENV VULKAN_SDK=/opt/vulkan-sdk/1.4.341.1/x86_64
6463
ENV PATH="${VULKAN_SDK}/bin:${PATH}"
6564
ENV LD_LIBRARY_PATH="${VULKAN_SDK}/lib:${LD_LIBRARY_PATH}"
6665
ENV VK_LAYER_PATH="${VULKAN_SDK}/share/vulkan/explicit_layer.d"
6766

68-
RUN wget -q https://sdk.lunarg.com/sdk/download/1.4.321.1/linux/vulkansdk-linux-x86_64-1.4.321.1.tar.xz && \
69-
tar -xf vulkansdk-linux-x86_64-1.4.321.1.tar.xz && \
67+
RUN wget -q https://sdk.lunarg.com/sdk/download/1.4.341.1/linux/vulkansdk-linux-x86_64-1.4.341.1.tar.xz && \
68+
tar -xf vulkansdk-linux-x86_64-1.4.341.1.tar.xz && \
7069
mkdir -p /opt/vulkan-sdk && \
71-
mv 1.4.321.1 /opt/vulkan-sdk/ && \
72-
rm -rf vulkansdk-linux-x86_64-1.4.321.1.tar.xz
70+
mv 1.4.341.1 /opt/vulkan-sdk/ && \
71+
rm -rf vulkansdk-linux-x86_64-1.4.341.1.tar.xz
7372

7473
# Install runtime libraries for test execution
7574
RUN apt-get update && apt-get install -y \

docker/print-env-info.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ echo "vulkan_sdk=${VULKAN_SDK:-not_set}"
1212
echo "vulkan_layer_path=${VK_LAYER_PATH:-not_set}"
1313
echo "vulkan_validation_api=$(grep -o '"api_version": "[^"]*"' "${VK_LAYER_PATH}/VkLayer_khronos_validation.json" 2>/dev/null | head -1 | cut -d'"' -f4 || echo 'unknown')"
1414
echo "vulkan_icd_api=$(grep -o '"api_version" : "[^"]*"' /etc/vulkan/icd.d/nvidia_icd.json 2>/dev/null | cut -d'"' -f4 || echo 'unknown')"
15-
echo "container_image=${CONTAINER_IMAGE:-ghcr.io/shader-slang/slang-linux-gpu-ci:v1.3.0}"
15+
echo "container_image=${CONTAINER_IMAGE:-ghcr.io/shader-slang/slang-linux-gpu-ci:v1.4.0}"
1616
echo "runner_name=${RUNNER_NAME:-unknown}"
1717
echo "ENV_INFO_END"

source/core/slang-secure-crt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,4 @@ inline int strncpy_s(char* strDest, size_t numberOfElements, const char* strSour
281281
#endif // HAVE_STRNCPY_S
282282
#endif // SLANG_CORE_SECURE_CRT_H
283283
#endif // _MSC_VER
284+

source/slang/slang-check-decl.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7812,21 +7812,21 @@ bool SemanticsVisitor::checkConformance(
78127812
auto superTypeDecl = superDeclRefType->getDeclRef().getDecl();
78137813
if (superTypeDecl->findModifier<ComInterfaceAttribute>())
78147814
{
7815-
// A struct cannot implement a COM Interface.
7816-
if (auto classDecl = as<ClassDecl>(superTypeDecl))
7815+
auto subTypeDecl = declRef.getDecl();
7816+
if (auto classDecl = as<ClassDecl>(subTypeDecl))
78177817
{
7818-
// OK.
7818+
// Classes can implement COM interfaces.
78197819
SLANG_UNUSED(classDecl);
78207820
}
7821-
else if (auto subInterfaceDecl = as<InterfaceDecl>(superTypeDecl))
7821+
else if (auto subInterfaceDecl = as<InterfaceDecl>(subTypeDecl))
78227822
{
78237823
if (!subInterfaceDecl->findModifier<ComInterfaceAttribute>())
78247824
{
78257825
getSink()->diagnose(
78267826
Diagnostics::InterfaceInheritingComMustBeCom{.decl = inheritanceDecl});
78277827
}
78287828
}
7829-
else if (const auto structDecl = as<StructDecl>(superTypeDecl))
7829+
else if (const auto structDecl = as<StructDecl>(subTypeDecl))
78307830
{
78317831
getSink()->diagnose(
78327832
Diagnostics::StructCannotImplementComInterface{.decl = inheritanceDecl});
@@ -8248,6 +8248,15 @@ void SemanticsDeclBasesVisitor::visitInterfaceDecl(InterfaceDecl* decl)
82488248
// a circular inheritance relationship.
82498249

82508250
_validateCrossModuleInheritance(decl, inheritanceDecl);
8251+
8252+
if (baseInterfaceDeclRef.getDecl()->findModifier<ComInterfaceAttribute>())
8253+
{
8254+
if (!decl->findModifier<ComInterfaceAttribute>())
8255+
{
8256+
getSink()->diagnose(
8257+
Diagnostics::InterfaceInheritingComMustBeCom{.decl = inheritanceDecl});
8258+
}
8259+
}
82518260
}
82528261

82538262
if (decl->findModifier<ComInterfaceAttribute>())

0 commit comments

Comments
 (0)