Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
Update Slang for new IArtifact interfaces (#65)
Browse files Browse the repository at this point in the history
* Update Slang for new IArtifact interfaces
Use V4 interface.

* Fix adding diagnostics.
  • Loading branch information
jsmall-zzz authored Apr 11, 2023
1 parent 36a237a commit cc73b89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion external/slang
Submodule slang updated 99 files
+2 −8 build/visual-studio/core/core.vcxproj
+2 −20 build/visual-studio/core/core.vcxproj.filters
+2 −8 build/visual-studio/slang-rt/slang-rt.vcxproj
+2 −20 build/visual-studio/slang-rt/slang-rt.vcxproj.filters
+5 −5 deps/target-deps.json
+22 −1 docs/target-compatibility.md
+10 −5 docs/user-guide/a1-02-slangpy.md
+98 −98 prelude/slang-cuda-prelude.h
+3 −0 prelude/slang-torch-prelude.h
+1 −1 premake5.lua
+4 −6 slang.h
+1 −0 source/compiler-core/slang-artifact-desc-util.cpp
+5 −3 source/compiler-core/slang-artifact-handler-impl.cpp
+1 −1 source/compiler-core/slang-artifact-handler-impl.h
+1 −24 source/compiler-core/slang-artifact-helper.cpp
+2 −11 source/compiler-core/slang-artifact-helper.h
+108 −194 source/compiler-core/slang-artifact-impl.cpp
+21 −86 source/compiler-core/slang-artifact-impl.h
+33 −1 source/compiler-core/slang-artifact-representation-impl.cpp
+7 −1 source/compiler-core/slang-artifact-representation-impl.h
+3 −0 source/compiler-core/slang-artifact-representation.h
+120 −21 source/compiler-core/slang-artifact-util.cpp
+26 −4 source/compiler-core/slang-artifact-util.h
+40 −71 source/compiler-core/slang-artifact.h
+22 −18 source/compiler-core/slang-downstream-compiler.cpp
+3 −1 source/compiler-core/slang-dxc-compiler.cpp
+2 −1 source/compiler-core/slang-fxc-compiler.cpp
+2 −1 source/compiler-core/slang-glslang-compiler.cpp
+2 −2 source/compiler-core/slang-json-source-map-util.cpp
+3 −2 source/compiler-core/slang-llvm-compiler.cpp
+1 −1 source/compiler-core/slang-nvrtc-compiler.cpp
+1 −1 source/compiler-core/slang-slice-allocator.cpp
+1 −0 source/compiler-core/slang-slice-allocator.h
+2 −2 source/core/slang-archive-file-system.cpp
+1 −1 source/core/slang-blob.h
+0 −136 source/core/slang-castable-list-impl.cpp
+0 −53 source/core/slang-castable-list-impl.h
+0 −68 source/core/slang-castable-list.h
+0 −58 source/core/slang-castable-util.h
+3 −3 source/core/slang-castable.cpp
+106 −0 source/core/slang-castable.h
+0 −68 source/core/slang-destroyable.h
+2 −2 source/core/slang-file-system.cpp
+0 −175 source/core/slang-lazy-castable-list.cpp
+0 −68 source/core/slang-lazy-castable-list.h
+3 −1 source/slang/core.meta.slang
+26 −42 source/slang/diff.meta.slang
+32 −0 source/slang/hlsl.meta.slang
+10 −0 source/slang/slang-check-constraint.cpp
+18 −1 source/slang/slang-check-decl.cpp
+14 −0 source/slang/slang-check-stmt.cpp
+10 −15 source/slang/slang-compiler.cpp
+4 −1 source/slang/slang-compiler.h
+4 −1 source/slang/slang-diagnostic-defs.h
+41 −15 source/slang/slang-emit-cpp.cpp
+2 −8 source/slang/slang-emit.cpp
+3 −0 source/slang/slang-ir-autodiff-fwd.cpp
+3 −0 source/slang/slang-ir-autodiff-rev.cpp
+10 −0 source/slang/slang-ir-autodiff.cpp
+44 −6 source/slang/slang-ir-inline.cpp
+4 −1 source/slang/slang-ir-inline.h
+39 −26 source/slang/slang-ir-legalize-types.cpp
+2 −1 source/slang/slang-ir-lower-generic-function.cpp
+5 −4 source/slang/slang-ir-lower-generic-type.cpp
+7 −1 source/slang/slang-ir-synthesize-active-mask.cpp
+19 −0 source/slang/slang-lower-to-ir.cpp
+1 −0 source/slang/slang-options.cpp
+1 −0 source/slang/slang-repro.cpp
+66 −63 source/slang/slang.cpp
+1 −1 tests/autodiff-dstdlib/dstdlib-sqrt.slang
+1 −1 tests/autodiff-dstdlib/dstdlib-sqrt.slang.expected.txt
+50 −0 tests/autodiff/high-order-forward-diff-struct.slang
+5 −0 tests/autodiff/high-order-forward-diff-struct.slang.expected.txt
+41 −0 tests/autodiff/overloaded-custom-deriv.slang
+2 −0 tests/autodiff/overloaded-custom-deriv.slang.expected.txt
+56 −0 tests/bugs/type-legalize-bug-1.slang
+4 −0 tests/bugs/type-legalize-bug-1.slang.expected.txt
+1 −2 tests/compute/loop-unroll.slang
+12 −0 tests/diagnostics/assign-in-if.slang
+14 −0 tests/diagnostics/assign-in-if.slang.expected
+10 −0 tests/diagnostics/dangling-comparison.slang
+8 −0 tests/diagnostics/dangling-comparison.slang.expected
+81 −0 tests/diagnostics/generic-type-inference-fail.slang
+9 −0 tests/diagnostics/generic-type-inference-fail.slang.expected
+6 −7 tests/experiments/generic/type-to-value-4.slang
+4 −0 tests/experiments/generic/type-to-value-4.slang.expected.txt
+31 −0 tests/slang-extension/realtime-clock.slang
+5 −0 tests/slang-extension/realtime-clock.slang.expected.txt
+1 −1 tools/gfx/cuda/cuda-command-queue.cpp
+4 −1 tools/gfx/cuda/cuda-device.cpp
+5 −0 tools/gfx/d3d11/d3d11-device.cpp
+1 −1 tools/gfx/d3d11/d3d11-scopeNVAPI.cpp
+9 −0 tools/gfx/d3d12/d3d12-device.cpp
+1 −1 tools/gfx/d3d12/d3d12-pipeline-state.cpp
+5 −0 tools/gfx/vulkan/vk-api.h
+14 −0 tools/gfx/vulkan/vk-device.cpp
+2 −2 tools/slang-reflection-test/slang-reflection-test-main.cpp
+3 −2 tools/slang-test/slang-test-main.cpp
+1 −2 tools/slang-unit-test/unit-test-file-system.cpp
14 changes: 8 additions & 6 deletions source/slang-llvm/slang-llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ extern "C" void /* __declspec(naked)*/ __cdecl __chkstk();
#endif

// Predeclare. We'll use this symbol to lookup timestamp, if we don't have a hash.
extern "C" SLANG_DLL_EXPORT SlangResult createLLVMDownstreamCompiler_V3(const SlangUUID& intfGuid, Slang::IDownstreamCompiler** out);
extern "C" SLANG_DLL_EXPORT SlangResult createLLVMDownstreamCompiler_V4(const SlangUUID& intfGuid, Slang::IDownstreamCompiler** out);

namespace slang_llvm {

Expand Down Expand Up @@ -556,7 +556,7 @@ SlangResult LLVMDownstreamCompiler::getVersionString(slang::IBlob** outVersionSt

{
// If we don't have the commitHash, we use the library timestamp, to uniquely identify.
versionString << " " << SharedLibraryUtils::getSharedLibraryTimestamp((void*)createLLVMDownstreamCompiler_V3);
versionString << " " << SharedLibraryUtils::getSharedLibraryTimestamp((void*)createLLVMDownstreamCompiler_V4);
}

*outVersionString = StringBlob::moveCreate(versionString).detach();
Expand Down Expand Up @@ -623,6 +623,7 @@ SlangResult LLVMDownstreamCompiler::compile(const CompileOptions& inOptions, IAr

ComPtr<IArtifactDiagnostics> diagnostics(new ArtifactDiagnostics);


// TODO(JS): We might just want this to talk directly to the listener.
// For now we just buffer up.
BufferedDiagnosticConsumer diagsBuffer(diagnostics);
Expand Down Expand Up @@ -856,7 +857,7 @@ SlangResult LLVMDownstreamCompiler::compile(const CompileOptions& inOptions, IAr
diagnostics->setResult(SLANG_FAIL);

auto artifact = ArtifactUtil::createArtifact(ArtifactDesc::make(ArtifactKind::None, ArtifactPayload::None));
artifact->addAssociated(diagnostics);
ArtifactUtil::addAssociated(artifact, diagnostics);

*outArtifact = artifact.detach();
return SLANG_OK;
Expand Down Expand Up @@ -958,7 +959,7 @@ SlangResult LLVMDownstreamCompiler::compile(const CompileOptions& inOptions, IAr
diagnostics->setResult(SLANG_FAIL);

auto artifact = ArtifactUtil::createArtifact(ArtifactDesc::make(ArtifactKind::None, ArtifactPayload::None));
artifact->addAssociated(diagnostics);
ArtifactUtil::addAssociated(artifact, diagnostics);

*outArtifact = artifact.detach();
return SLANG_OK;
Expand Down Expand Up @@ -1040,7 +1041,8 @@ SlangResult LLVMDownstreamCompiler::compile(const CompileOptions& inOptions, IAr
const auto targetDesc = ArtifactDescUtil::makeDescForCompileTarget(options.targetType);

auto artifact = ArtifactUtil::createArtifact(targetDesc);
artifact->addAssociated(diagnostics);
ArtifactUtil::addAssociated(artifact, diagnostics);

artifact->addRepresentation(sharedLibrary);

*outArtifact = artifact.detach();
Expand All @@ -1053,7 +1055,7 @@ SlangResult LLVMDownstreamCompiler::compile(const CompileOptions& inOptions, IAr

} // namespace slang_llvm

extern "C" SLANG_DLL_EXPORT SlangResult createLLVMDownstreamCompiler_V3(const SlangUUID& intfGuid, Slang::IDownstreamCompiler** out)
extern "C" SLANG_DLL_EXPORT SlangResult createLLVMDownstreamCompiler_V4(const SlangUUID& intfGuid, Slang::IDownstreamCompiler** out)
{
Slang::ComPtr<slang_llvm::LLVMDownstreamCompiler> compiler(new slang_llvm::LLVMDownstreamCompiler);

Expand Down

0 comments on commit cc73b89

Please sign in to comment.