| Commit message (Collapse) | Author | Age |
| ... | |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Initial plan
* Fix pragma warning not working with multifile modules
- Check if DiagnosticSink already has a WarningStateTracker before creating new one
- This preserves pragma warning state across __include'd files
- Add regression tests for multifile pragma warnings
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Add additional test cases for nested pragma warnings
- Test nested __include scenarios with pragma warning directives
- Verify pragma warnings work correctly with multiple levels of includes
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* Omit "Repro" category from default help text output
* format code (#24)
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
---------
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| |
|
|
| |
Add support for kIROp_PtrLit types in metal and add a test for null pointer
values, which is the only valid value.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
close #7931.
For a generic callable, we have two passes overload resolution, in first pass, we will resolve
the generic by only checking the generic parameters, while in the second pass, we will resolve
the function signature to resolve the overload.
But in our candidate comparison logic, we pick a preferred generic even two generics are equally
good. However, we should not make this decision in the first pass, because we don't know about
the function arguments in this pass yet. So we just return OverloadEpxr2 in this case, and let the
function overload resolution to break the tie.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fix bug
* fix test
* push test changs for clarity
* fix bug
* fix test
* push test changs for clarity
* test what fails
* remove redundant code
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix 7441: CUDA boolean vector layout to use 1-byte elements
Boolean vectors (bool1, bool2, bool3, bool4) were incorrectly implemented
as integer-based types using 4 bytes per element instead of actual 1-byte
boolean elements on CUDA targets.
Changes:
- Update CUDA prelude to define boolean vectors as structs with bool fields
instead of typedef aliases to integer vectors
- Implement CUDALayoutRulesImpl::GetVectorLayout to use 1-byte alignment
for boolean vectors, matching actual CUDA memory layout behavior
- Update make_bool functions to populate struct fields correctly
This ensures boolean vectors have the same memory layout as bool[4] arrays:
- bool1: 1 byte (was 4 bytes)
- bool2: 2 bytes (was 8 bytes)
- bool3: 3 bytes (was 12 bytes)
- bool4: 4 bytes (was 16 bytes)
Fixes memory layout mismatch between Slang reflection API and actual
CUDA compilation, achieving 75% memory savings for boolean vector usage.
* Fix CI issues -
Add and update associated functions and operators
* Make boolX same as uchar
* Use align construct on struct for boolX
* Improve Test case for robust alignment checks
* Formatting
* Disable selected slangpy tests
* add metal check which is slightly different than cuda
* Test-1
* Test-2
* Test-3
* Test-4
* ReflectionChange
* cleanup and update
* _slang_select with plain bool is needed for reverse-loop-checkpoint-test
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* Omit "Invalid" capability from slangc -h output
* format code (#23)
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
---------
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
seperately (#8012)
* Omit listing values in slangc -h cmdline output, show how to list them seperately
* format code (#22)
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
---------
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Initial plan
* Fix segfault in ray tracing parameter consolidation
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Fix.
* Fix.
* Keep entrypoint param layout consistent during `MoveEntryPointUniformParametersToGlobalScope`.
* Fix.
* fix.
* Fix.
* Fix pending layout handling.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add matrix select intrinsic
* Fix hlsl test
* Restrict matrix select to HLSL
* Better test for HLSL side
* Select route for GLSL/SPIRV
* Exclude matrices from select legalization
* Exclude CUDA from select test
* Inline and move
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Handle debug-layer messages in a separate channel
The Problem (Issue #7343)
The issue was that Vulkan Validation Layer error messages were being mixed into regular test output, causing
potential false positives or negatives. When using -enable-debug-layers true, validation messages would appear in
the same output stream as test results, potentially matching //CHECK: patterns incorrectly.
Example Problem:
- Test expects: //CHECK: 1
- Validation layer prints: VALIDATION ERROR: 1 invalid buffer binding
- Test incorrectly matches the "1" in the error message instead of the actual output
Slang Test Communication Architecture
Execution Modes
Slang has 3 different execution modes controlled by SpawnType:
enum class SpawnType {
UseSharedLibrary, // In-process execution
UseTestServer, // Out-of-process via persistent server
UseFullyIsolatedTestServer, // Out-of-process via isolated server
UseExe // Direct executable spawn
}
1. In-Process Mode (UseSharedLibrary)
┌─────────────────────────────────────────┐
│ slang-test │
│ ┌─────────────┐ ┌─────────────────┐ │
│ │render-test │ │gfx-unit-test │ │
│ │unit-test │ │slangc library │ │
│ └─────────────┘ └─────────────────┘ │
│ │ │ │
│ └───► StdWriters ◄──┘ │
│ (shared) │
└─────────────────────────────────────────┘
- Communication: Direct function calls, shared memory
- Debug callbacks: Single callback instance in StdWriters
- Used when: Default mode for most tests
2. Out-of-Process Mode (UseTestServer)
┌──────────────────┐ JSON-RPC ┌──────────────────┐
│ slang-test │◄──over pipes────┤ test-server.exe │
│ │ │ │
│ ┌─────────────┐ │ │ ┌─────────────┐ │
│ │StdWriters │ │ │ │render-test │ │
│ │+debug │ │ │ │gfx-unit-test│ │
│ │callback │ │ │ │+debug │ │
│ └─────────────┘ │ │ │callback │ │
└──────────────────┘ │ └─────────────┘ │
└──────────────────┘
- Communication: JSON-RPC over stdin/stdout pipes
- Debug callbacks: Separate instances in each process
- Used when: CI/CD, multi-threaded testing, crash isolation
3. Direct Executable Mode (UseExe)
┌──────────────────┐ pipes ┌──────────────────┐
│ slang-test │◄───────────────┤ slangc.exe │
│ │ │ other tools │
└──────────────────┘ └──────────────────┘
- Communication: Standard process pipes (stdout/stderr)
- Debug callbacks: None (external executables)
- Used when: Testing external tools
Communication Mechanisms Deep Dive
JSON-RPC Protocol Over Pipes
The test-server.exe communicates with slang-test using JSON-RPC over stdin/stdout pipes:
// Parent process (slang-test) creates child with pipes
Process* testServerProcess = /* spawn test-server.exe */;
// JSONRPCConnection wraps the pipe communication
JSONRPCConnection connection;
connection.initWithStdStreams(); // Uses stdin/stdout pipes
// Send RPC call
TestServerProtocol::ExecutionResult result;
connection.sendCall("executeTool", &args, &result);
Key Point: The pipes carry structured JSON messages, not raw stdout/stderr. This is what enables clean separation
of different data channels.
Protocol Structure
Your changes extend the ExecutionResult protocol:
struct ExecutionResult {
String stdOut; // Regular program output
String stdError; // Error messages
String debugLayer; // NEW: Debug/validation messages
int32_t result;
int32_t returnCode;
};
Your Debug Layer Solution
The Challenge
Memory pointers cannot cross process boundaries. A debugCallback pointer in the parent process is meaningless in
the child process.
The Solution: String-Based Serialization
You solved this by using string capture and serialization:
1. Debug Callback Interface (slang-std-writers.h)
class IDebugCallback {
virtual void handleMessage(
DebugMessageType type,
DebugMessageSource source,
const char* message) = 0;
};
2. String-Capturing Implementation (slang-support.h)
class CoreDebugCallback : public Slang::IDebugCallback {
StringBuilder m_buf; // Captures messages as strings
void handleMessage(DebugMessageType type, DebugMessageSource source, const char* message) {
if (type == DebugMessageType::Error) {
m_buf << message << '\n'; // Serialize to string
}
}
String getString() { return m_buf.toString(); } // Extract accumulated messages
};
3. Bridge Between RHI and Core (slang-support.h)
class CoreToRHIDebugBridge : public rhi::IDebugCallback {
Slang::IDebugCallback* m_coreCallback;
void handleMessage(rhi::DebugMessageType type, rhi::DebugMessageSource source, const char* message) {
// Convert RHI types to core types and forward
m_coreCallback->handleMessage(convertType(type), convertSource(source), message);
}
};
Data Flow: Debug Messages End-to-End
In-Process Mode Flow
GPU Driver → RHI Debug Callback → Core Debug Callback → String Buffer → Test Output
Out-of-Process Mode Flow
Child Process:
GPU Driver → RHI Debug Callback → Core Debug Callback → String Buffer
↓
Parent Process: JSON-RPC Serialization
Test Output ← String Processing ← ExecutionResult.debugLayer ←┘
Step-by-Step Example
1. Test Execution Starts
// In test-server process
CoreDebugCallback debugCallback;
CoreToRHIDebugBridge bridge;
bridge.setCoreCallback(&debugCallback);
// Set up graphics device with debug layers
deviceDesc.debugCallback = &bridge;
2. Graphics API Call Triggers Validation Error
// Inside Vulkan driver (external code)
// Validation layer detects error and calls our callback
bridge.handleMessage(RHI_ERROR, RHI_LAYER, "Invalid buffer binding");
3. Message Capture
// In CoreDebugCallback::handleMessage
m_buf << "Invalid buffer binding\n"; // Stored in string buffer
4. Test Completion & Serialization
// Back in test-server
TestServerProtocol::ExecutionResult result;
result.debugLayer = debugCallback.getString(); // "Invalid buffer binding\n"
result.stdOut = "1"; // Regular test output
// Send via JSON-RPC
connection.sendResult(&result);
5. Parent Process Receives & Separates Output
// In slang-test process
String output = buildTestOutput(result);
// Results in clean separation:
// standard output = {
// 1
// }
// debug layer = {
// Invalid buffer binding
// }
Why This Solution Works
1. Process Isolation: Each process has its own callback objects, no shared pointers
2. String Serialization: Debug messages converted to strings that can cross process boundaries
3. Protocol Extension: Uses existing JSON-RPC infrastructure, just adds new field
4. Clean Separation: Debug messages never mix with stdout/stderr
5. Backward Compatibility: Existing tests unaffected, debug layer field optional
Key Benefits
- Eliminates False Positives: Debug messages can't interfere with //CHECK: patterns
- Better Debugging: Debug messages clearly separated and labeled
- Robust Architecture: Works across all execution modes
- Minimal Changes: Leverages existing communication infrastructure
This elegant solution transforms a fundamental cross-process communication challenge into a simple string
serialization problem, using the existing test server architecture to cleanly separate validation layer messages
from test results.
* Cover the missing slang-test execution path
* format code (#82)
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
---------
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
| |
This commit fixes two problems.
1. uninitialized file handle for lock-file test
2. uninitialized static variable for lock-file test
The first bug is more of speculartive rather than actual bug.
The second bug was causing heap corruption when it was retried, because
the counter was not reset to zero on "retry" and it wrote data to an
invalida range in an array.
|
| |
|
|
|
|
| |
Closes https://github.com/shader-slang/slang/issues/3646
New tests rather than just adding another TEST line to existing tests so
that we get the msvc- prefix in the output of slang-test
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix static const variables without initializers causing internal errors
Add validation in SemanticsDeclHeaderVisitor::checkVarDeclCommon to detect static const variables without initializers and emit proper error diagnostics instead of allowing internal errors to escape during SPIR-V generation.
- Add new diagnostic (ID 31225) for static const variables without initializers
- Skip validation for extern static const variables
- Skip validation for interface member variables
- Add comprehensive test case covering various scenarios
Fixes #7989
Co-authored-by: ArielG-NV <ArielG-NV@users.noreply.github.com>
* clean up test and implementation
* format code (#7994)
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: ArielG-NV <ArielG-NV@users.noreply.github.com>
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add emit cases for WGSL and GLSL
* Fix compilation warnings
Modify short cutting test to reflect change in emit logic
Lower matrix for metal as well
Add emit matrix logic for metal
Fix compiler warning
Brace initializer for lowered matrices
Fix compiler warnings
* Tests for metal
* Fix mult, any, and determinant
* Fix matrix-matrix multiplication
* Fix mat mul to be element-wise
* Fix compiler warning
* Move makeMatrix to legalization
* Move unary and binary arithmetic operator lowering to legalization
* Remove emit logic and move final comparison operators to legalization
* Handle vector/matrix negation for WGSL
* Restore older SPIR-V emit logic
* Address PR comments
* Revert to zero minus for negation
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#7843)
* Fix 64-bit val lowering for metal
* Add ByteAddressBuffer load/store 64-bit tests
* Handle Store/Load ptr types
* Use bitcast for non-pointer typers
* format code (#7966)
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
---------
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Show signature help on generic parameters.
* Fix.
* Update tests.
* slang-test: make vvl error go through stderr.
* update slang-rhi
* Update slang-rhi
|
| |
|
| |
Closes https://github.com/shader-slang/slang/issues/3386
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Improve diagnostics over ambiguous references.
* Fix.
* Remove files.
* Fix some optix hitobject intrinsics.
* Fix some hitobject intrinsics for optix.
* Fix.
* update rhi
* revert slang-rhi
* Update slang-rhi
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Initial plan
* Add U32_firstbitlow implementation for CUDA and CPP backends
Co-authored-by: bmillsNV <163073245+bmillsNV@users.noreply.github.com>
* Add I32_firstbitlow and comprehensive testing for signed/unsigned firstbitlow
Co-authored-by: bmillsNV <163073245+bmillsNV@users.noreply.github.com>
* Convert firstbitlow test to use inline filecheck syntax
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
* Add U32_firstbithigh and I32_firstbithigh implementations for CUDA and CPP backends
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Update prelude/slang-cpp-scalar-intrinsics.h
* Update prelude/slang-cpp-scalar-intrinsics.h
* Update prelude/slang-cpp-scalar-intrinsics.h
* Refactor Metal bit intrinsics to handle zero case correctly
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
* Update slang-cuda-prelude.h
remove fake links
* Update hlsl.meta.slang
* if -1, return -1 due to implicit hlsl rule
* -1 or 0 is ~0u as per hlsl implictly
* 0 or -1 as per hlsl
* fix the math to map to hlsl
* fix compile error
* forgot `31 - clz`
* format code (#7943)
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
* Update source/slang/hlsl.meta.slang
* Update source/slang/hlsl.meta.slang
* Update source/slang/hlsl.meta.slang
* Update source/slang/hlsl.meta.slang
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: bmillsNV <163073245+bmillsNV@users.noreply.github.com>
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
Co-authored-by: ArielG-NV <aglasroth@nvidia.com>
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| |
|
|
| |
statements (#7953)
|
| |
|
|
|
|
|
| |
* Update slang-rhi
* Fix profile lookup on `nullptr`.
* update rhi
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix mesh shader reflection JSON output
Fixes issue #7736 where mesh shaders were showing stage "UNKNOWN" and missing type information in reflection JSON output.
Changes:
- Add missing SLANG_STAGE_MESH and SLANG_STAGE_AMPLIFICATION cases to shader stage switch statements in emitReflectionVarBindingInfoJSON and emitReflectionEntryPointJSON
- Add missing MeshOutput to TypeReflection::Kind enum in slang.h
- Add missing type kind cases (OutputStream, MeshOutput, Specialized, None) to emitReflectionTypeInfoJSON
Testing:
- Simple mesh shader now correctly shows "stage": "mesh" instead of "UNKNOWN"
- Complex mesh shader with parameters shows proper stage and input type information
- Output parameters show "kind": "None" instead of crashing with assertion
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: pdeayton-nv <pdeayton-nv@users.noreply.github.com>
* Remove test files from mesh shader reflection fix
As requested, removed test files since there is no testing infrastructure
for reflection JSON output. Focus is now only on the core mesh and
amplification shader reflection fixes.
Co-authored-by: pdeayton-nv <pdeayton-nv@users.noreply.github.com>
* Address review comments: move MeshOutput enum to end and restore assert
- Move MeshOutput enum member to end of TypeReflection::Kind enum for backward compatibility
- Replace fprintf with SLANG_ASSERT for unhandled type kinds
Co-authored-by: pdeayton-nv <pdeayton-nv@users.noreply.github.com>
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: pdeayton-nv <pdeayton-nv@users.noreply.github.com>
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
| |
Fixes #7903
SPV_NV_viewport_array2 says ViewportMaskNV corresponds to gl_ViewportMask
|
| |
|
|
|
|
|
|
|
| |
* emit literal values in getTypeNameHint for bool, str etc.
* add test for specializing generics with bool literals
* fix build error
* add specializing with Enum type test
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Texture2D from Sampler2D (#7901)
* Initial plan
* Add SLANG_TEXTURE_COMBINED_FLAG to differentiate combined texture-samplers
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Fix regression in hlsl-to-vulkan-combined test by updating expected output
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Initial plan
* Initial investigation and plan for enum vertex output fix
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Fix compiler crash when enum is used as vertex output data
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Fix compiler crash when enum is used as vertex output data
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Address reviewer feedback: use SLANG_ASSERT and improve CHECK directives
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
OpMemberName instructions were all using member index 0 instead of
incrementing indices (0, 1, 2, ...) as required by the SPIR-V spec.
The bug was that the member index increment (id++) was only happening
for physical struct types, but OpMemberName emission occurs for all
struct types when they have name decorations.
This fix ensures member indices are properly incremented for both
physical and non-physical struct types.
Fixes #7909
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: davli-nv <davli-nv@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix metallib-asm target parsing by adding missing comma
The metallib-asm target was not being recognized from command line because
of a syntax error in the target string definition in slang-type-text-util.cpp.
A missing comma after the first "metallib-asm" string caused C++ string
literal concatenation to create a malformed string.
Resolves #7774
Co-authored-by: Jay Kwak <jkwak-work@users.noreply.github.com>
* format code (#7910)
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
* regenerate command line reference (#7911)
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
---------
Co-authored-by: Claude Code <claude@anthropic.com>
Co-authored-by: Jay Kwak <jkwak-work@users.noreply.github.com>
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Avoid early specialization for witness tables in SimplifyIR
Prevents SimplifyIR from prematurely specializing witness tables before
the main specialization pass. Witness tables are hoistable immutable
objects that must maintain consistent signatures to avoid incorrect
deduplication. SimplifyIR was incorrectly transforming expressions like
"witness_table_t(%IFoo)(specialize(%7, %GenericValue4))" into
"witness_table_t(%IFoo)(%Foo)" even when %GenericValue4 was unused.
Fixes #7233
* Add a missing test file
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Organize code better by splitting some big files
The basic change here is that the majority of the declarations in `slang-compiler.h` have been split out into a set of smaller and more focused files.
As a result, the implement of those declarations have been moved from `slang-compiler.cpp` and `slang.cpp` over to those new files when the proper home for code is obvious.
I have tried as much as possible to *not* make any edits to the code along the way, and just copy-paste declarations from one place to another as-is.
The exceptions I am aware of are:
* In some cases a function that used to be file-scope `static` was used by code that landed in two or more different `.cpp` files. In these cases, I changed the function to be non-`static` (removing the `_` prefix from its name, if it had one, per our naming conventions), and put a declaration for the function into the most appropriate header I could identify.
* I added a few comments in places where I saw ugly or unfortunate things in the code I was moving, and wanted to tag them with `TODO`s so we can hopefully get to them in the fullness of time.
* I added top-level comments to each of the new `.h` files that was introduced to try to explain the logic for what goes into that file.
* In cases where one of the new header files mostly existed to declare a single type, I sometimes added more detail to the doc comment on that type, to better explain the type and its role in the compiler (this is text that otherwise might have gone into the comment at the top leve lof the file, but I figured that the doc comment would have higher discoverability).
I expect that the most contentious choice here is that the `Session` class lands in `slang-global-session.h` while `slang-session.h` holds the `Linkage` class.
The names used in this change are consistent with how the relevant concepts in the public Slang API are named, and are consistent with how we *intend* to rename the classes themselves in time.
* format code
* fixup
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Initial plan
* Add improved diagnostic for interface return type mismatches
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Complete fix for interface return type mismatch error reporting
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Move diagnostic to synthesis phase for better interface return type mismatch errors
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Remove extraneous test file and update .gitignore
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Add diagnostic test for interface return type mismatch and apply formatting
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Address feedback: restore whitespace and use filecheck for diagnostic test
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Fix logic error in return type mismatch detection
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Remove unnecessary flag by using out parameter for diagnostic tracking
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Refactor witness synthesis failure reporting to use structured approach
Replace ad-hoc `outSpecificDiagnosticEmitted` parameter with `WitnessSynthesisFailureReason` enum and `MethodWitnessSynthesisFailureDetails` struct as requested in code review. This provides:
- Clear taxonomy of failure reasons (General, MethodResultTypeMismatch, MethodParameterMismatch)
- Centralized diagnostic emission in findWitnessForInterfaceRequirement
- Better extensibility for future failure types
- Improved maintainability by removing state tracking flags
The return type mismatch diagnostic continues to work correctly, showing error 38106 with precise location information.
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Remove unused MethodParameterMismatch enum and duplicate code
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Remove redundant requiredMethod field from MethodWitnessSynthesisFailureDetails
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Address feedback: add outFailureDetails guard and remove unnecessary hasReturnTypeError variable
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Fix regression: restore original diagnostic message for mutating method mismatch
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Fix.
* Fix.
* Remove `innerSink`.
* Print candidates considered for interface match upon error.
* Fix tests.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
Co-authored-by: Yong He <yonghe@outlook.com>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
inherited through structs (#7597)
* Eliminate null-pointer reference in multilevel struct interface inheritance
* Add test
* Replace witness nullptr guard with conformance check to skip the witness
* Update test
* Skip creating transitive witness entirely for struct-struct-interface
* format code (#14)
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
* Removes casts, check for identity witness
---------
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
* Document how to use LLDB in the Slang codebase
* Include `slang_lldb.py` in `.lldbinit`
* Switch from GCC to Clang
* Include a VS Code task to build before debugging
* Fix clangd
|
| | |
|
| | |
|
| |
|
|
|
| |
* Fix visibility of synthesized `Differential` typedefs.
* Delete incorrect test.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Initial plan
* Fix public unscoped enum constants visibility across module boundaries
Add visibility modifier copying in CompleteDecl for unscoped enum cases.
When synthesizing static const declarations for unscoped enum cases,
copy the visibility modifiers from the original enum declaration to
ensure they have the same visibility scope across module boundaries.
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Create new visibility modifier instances instead of sharing existing ones
Address reviewer feedback to avoid sharing modifier instances between
declarations since modifiers form a linked list. Now creates new
instances of the appropriate visibility modifier type (Public, Private,
or Internal) instead of reusing the existing instance.
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Move unscoped enum visibility tests into subdirectory structure
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Use createByNodeType for visibility modifier creation as suggested
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* format code (#7867)
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix scalar to array conversion for tessellation factors in GLSL legalization
Add scalar-to-array conversion support in adaptType() function to handle
cases where users declare scalar tessellation factors (e.g., float TessLevelInner)
but GLSL requires arrays (float[2] for gl_TessLevelInner). This prevents the
generation of BuiltinCast instructions that crash the SPIR-V emitter.
Fixes crash: "unimplemented: Unhandled local inst in spirv-emit: BuiltinCast"
- Add scalar-to-array case in slang-ir-glsl-legalize.cpp adaptType()
- Fill all array elements with the scalar value for tessellation factors
- Add test case for scalar tessellation factor conversion
Fixes #7000
Co-authored-by: Yong He <csyonghe@users.noreply.github.com>
* Apply review feedback fixes
- Change test directive to TEST:SIMPLE
- Use IRArrayType instead of IRArrayTypeBase
- Use MakeArrayFromElement for cleaner scalar-to-array conversion
Co-authored-by: Yong He <csyonghe@users.noreply.github.com>
* Fix type conversion in scalar-to-array tessellation factor conversion
Convert scalar value to array element type before creating array to handle
cases where scalar type differs from array element type (e.g., int to float[3]).
Co-authored-by: Yong He <csyonghe@users.noreply.github.com>
* Use CHECK-DAG for order-independent tessellation factor checks
Co-authored-by: Yong He <csyonghe@users.noreply.github.com>
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Yong He <csyonghe@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Initial plan
* Fix segfault when using -separate-debug-info with unsupported targets
Add validation to emit a diagnostic error when -separate-debug-info is used
with targets other than SPIR-V binary. Previously, this would cause a segfault
because the separate debug info logic is only implemented for SPIR-V targets.
Changes:
- Added new diagnostic error (ID 18) for unsupported separate debug info usage
- Added validation in OptionsParser::_parse() to check target compatibility
- Created test cases for HLSL and GLSL targets to verify the fix
- Updated error message to clarify only SPIR-V binary targets are supported
The fix prevents segfaults and provides clear feedback to users about
target limitations for the -separate-debug-info option.
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Address feedback: fix segfault properly instead of preventing it
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
| |
* Fix crash when private ctor is used for coercion.
* Fix tests.
* Fix.
* Fix test error.
|
| |
|
|
|
|
|
| |
(#7827)
findFunctionByNameInType was only returning one function when multiple functions existed with the same name but different signatures. This broke reflection functionality for extension methods.
Fix the issue by changing findDeclFromStringInType by not calling maybeResolveOverloadedExpr if checkedTerm is overloaded functions. We still call maybeResolveOverloadedExpr when any candidates in the overloaded list is not DeclRefExpr referencing a function.
|
| | |
|
| | |
|