summaryrefslogtreecommitdiff
path: root/source/slang
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-08-24 09:25:51 -0400
committerGitHub <noreply@github.com>2022-08-24 09:25:51 -0400
commitf5755019246504ad4da4614d1e34a00d74970ea7 (patch)
tree8a0228427bd493681cffa2a94052c61dbc497a5d /source/slang
parent6ab0baf910dea838dca2d29557c3361297180a34 (diff)
Assorted Artifact improvements (#2374)
* #include an absolute path didn't work - because paths were taken to always be relative. * WIP replacing DownstreamCompileResult. * First attempt at replacing DownstreamCompileResult with IArtifact and associated types. * Small renaming around CharSlice. * ICastable -> ISlangCastable Added IClonable Fix issue with cloning in ArtifactDiagnostics. * Only add the blob if one is defined in DXC. * Guard adding blob representation. * Make cloneInterface available across code base. Set enums backing type for ArtifactDiagnostic. * Added ::create for ArtifactDiagnostics. * Use SemanticVersion for DownstreamCompilerDesc. Set sizes for enum types. * Depreciate old incompatible CompileOptions. Change SemanticVersion use 32 bits for the patch. * Split out CastableUtil. * Change IDownstreamCompiler to use canConvert and convert to use artifact types. * Fix typos. * Fix typo bug. Allow trafficing in PTX assembly/binaries * struct DownstreamCompilerBaseUtil -> struct DownstreamCompilerUtilBase * Add other riff types. * Small fix around artifact kind. * Make using slices instead of strings explicit on atomic ref counted types. (not complete). Added IArtifactList. Use IArtifactList to hold the 'associated' files. Use IUnknown for scoping for atomic ref counting. Small naming improvements. * Make artifact not use String in construction (so it owns contents). * Calculate compile products as artifacts. * Small improvements around ArtifactDesc. * Use ICastableList for list of artifacts and remove IArtifactList.
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/slang-compiler.cpp10
-rw-r--r--source/slang/slang-emit-cpp.cpp2
-rw-r--r--source/slang/slang-emit.cpp2
-rw-r--r--source/slang/slang-options.cpp8
-rw-r--r--source/slang/slang-parameter-binding.cpp2
-rw-r--r--source/slang/slang-type-layout.cpp2
-rw-r--r--source/slang/slang.cpp2
7 files changed, 14 insertions, 14 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index a41463ad5..d50350b29 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -44,7 +44,7 @@ namespace Slang
bool isHeterogeneousTarget(CodeGenTarget target)
{
- return ArtifactDescUtil::makeDescFromCompileTarget(asExternal(target)).style == ArtifactStyle::Host;
+ return ArtifactDescUtil::makeDescForCompileTarget(asExternal(target)).style == ArtifactStyle::Host;
}
void printDiagnosticArg(StringBuilder& sb, CodeGenTarget val)
@@ -909,7 +909,7 @@ namespace Slang
static bool _isCPUHostTarget(CodeGenTarget target)
{
- auto desc = ArtifactDescUtil::makeDescFromCompileTarget(asExternal(target));
+ auto desc = ArtifactDescUtil::makeDescForCompileTarget(asExternal(target));
return desc.style == ArtifactStyle::Host;
}
@@ -1230,7 +1230,7 @@ namespace Slang
// If we aren't using LLVM 'host callable', we want downstream compile to produce a shared library
if (compilerType != PassThroughMode::LLVM &&
- ArtifactDescUtil::makeDescFromCompileTarget(asExternal(target)).kind == ArtifactKind::HostCallable)
+ ArtifactDescUtil::makeDescForCompileTarget(asExternal(target)).kind == ArtifactKind::HostCallable)
{
target = CodeGenTarget::ShaderSharedLibrary;
}
@@ -1242,9 +1242,9 @@ namespace Slang
options.libraryPaths.add(Path::getParentDirectory(Path::getExecutablePath()));
// Set up the library artifact
- auto artifact = Artifact::create(ArtifactDesc::make(ArtifactKind::Library, Artifact::Payload::HostCPU), "slang-rt");
+ auto artifact = Artifact::create(ArtifactDesc::make(ArtifactKind::Library, Artifact::Payload::HostCPU), toSlice("slang-rt"));
- ComPtr<IFileArtifactRepresentation> fileRep(new FileArtifactRepresentation(IFileArtifactRepresentation::Kind::NameOnly, "slang-rt", nullptr, nullptr));
+ ComPtr<IFileArtifactRepresentation> fileRep(new FileArtifactRepresentation(IFileArtifactRepresentation::Kind::NameOnly, toSlice("slang-rt"), nullptr, nullptr));
artifact->addRepresentation(fileRep);
options.libraries.add(artifact);
diff --git a/source/slang/slang-emit-cpp.cpp b/source/slang/slang-emit-cpp.cpp
index 345b6548a..9c1573bf8 100644
--- a/source/slang/slang-emit-cpp.cpp
+++ b/source/slang/slang-emit-cpp.cpp
@@ -1655,7 +1655,7 @@ CPPSourceEmitter::CPPSourceEmitter(const Desc& desc):
//m_semanticUsedFlags = SemanticUsedFlag::GroupID | SemanticUsedFlag::GroupThreadID | SemanticUsedFlag::DispatchThreadID;
- const auto artifactDesc = ArtifactDescUtil::makeDescFromCompileTarget(asExternal(getTarget()));
+ const auto artifactDesc = ArtifactDescUtil::makeDescForCompileTarget(asExternal(getTarget()));
// If we have runtime library we can convert to a terminated string slice
m_hasString = (artifactDesc.style == ArtifactStyle::Host);
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 11e0812d9..a8d3390f0 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -187,7 +187,7 @@ Result linkAndOptimizeIR(
auto targetRequest = codeGenContext->getTargetReq();
// Get the artifact desc for the target
- const auto artifactDesc = ArtifactDescUtil::makeDescFromCompileTarget(asExternal(target));
+ const auto artifactDesc = ArtifactDescUtil::makeDescForCompileTarget(asExternal(target));
// We start out by performing "linking" at the level of the IR.
// This step will create a fresh IR module to be used for
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index c40e5d16c..a28217fd8 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -1484,7 +1484,7 @@ struct OptionsParser
const String name = ArtifactDescUtil::getBaseNameFromPath(desc, path.getUnownedSlice());
// Create the artifact
- auto artifact = Artifact::create(desc, name);
+ auto artifact = Artifact::create(desc, name.getUnownedSlice());
// There is a problem here if I want to reference a library that is a 'system' library or is not directly a file
// In that case the path shouldn't be set and the name should completely define the library.
@@ -1495,11 +1495,11 @@ struct OptionsParser
if (Path::getPathExt(path).getLength() <= 0)
{
// If there is no extension *assume* it is the name of a system level library
- fileRep = new FileArtifactRepresentation(IFileArtifactRepresentation::Kind::NameOnly, path, nullptr, nullptr);
+ fileRep = new FileArtifactRepresentation(IFileArtifactRepresentation::Kind::NameOnly, path.getUnownedSlice(), nullptr, nullptr);
}
else
{
- fileRep = new FileArtifactRepresentation(IFileArtifactRepresentation::Kind::Reference, path, nullptr, nullptr);
+ fileRep = new FileArtifactRepresentation(IFileArtifactRepresentation::Kind::Reference, path.getUnownedSlice(), nullptr, nullptr);
if (!fileRep->exists())
{
sink->diagnose(referenceModuleName.loc, Diagnostics::libraryDoesNotExist, path);
@@ -2045,7 +2045,7 @@ struct OptionsParser
// and output type is callable, add an empty' rawOutput.
if (rawOutputs.getCount() == 0 &&
rawTargets.getCount() == 1 &&
- ArtifactDescUtil::makeDescFromCompileTarget(asExternal(rawTargets[0].format)).kind == ArtifactKind::HostCallable)
+ ArtifactDescUtil::makeDescForCompileTarget(asExternal(rawTargets[0].format)).kind == ArtifactKind::HostCallable)
{
RawOutput rawOutput;
rawOutput.impliedFormat = rawTargets[0].format;
diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp
index 0a5df003a..07875c183 100644
--- a/source/slang/slang-parameter-binding.cpp
+++ b/source/slang/slang-parameter-binding.cpp
@@ -3031,7 +3031,7 @@ static int _calcTotalNumUsedRegistersForLayoutResourceKind(ParameterBindingConte
static bool _isCPUTarget(CodeGenTarget target)
{
- const auto desc = ArtifactDescUtil::makeDescFromCompileTarget(asExternal(target));
+ const auto desc = ArtifactDescUtil::makeDescForCompileTarget(asExternal(target));
return ArtifactDescUtil::isCpuLikeTarget(desc);
}
diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp
index 73ccd4726..5a32f6566 100644
--- a/source/slang/slang-type-layout.cpp
+++ b/source/slang/slang-type-layout.cpp
@@ -1618,7 +1618,7 @@ bool isKhronosTarget(TargetRequest* targetReq)
bool isCPUTarget(TargetRequest* targetReq)
{
- return ArtifactDescUtil::isCpuLikeTarget(ArtifactDescUtil::makeDescFromCompileTarget(asExternal(targetReq->getTarget())));
+ return ArtifactDescUtil::isCpuLikeTarget(ArtifactDescUtil::makeDescForCompileTarget(asExternal(targetReq->getTarget())));
}
bool isCUDATarget(TargetRequest* targetReq)
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 3fce0e6d9..2224c10bf 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -733,7 +733,7 @@ SlangPassThrough Session::getDownstreamCompilerForTransition(SlangCompileTarget
return (SlangPassThrough)m_codeGenTransitionMap.getTransition(source, target);
}
- const auto desc = ArtifactDescUtil::makeDescFromCompileTarget(inTarget);
+ const auto desc = ArtifactDescUtil::makeDescForCompileTarget(inTarget);
// Special case host-callable
if ((desc.kind == ArtifactKind::HostCallable) &&