Skip to content

Commit

Permalink
Merge branch 'master' into capabilities-warn-or-error-if-upgraded-imp…
Browse files Browse the repository at this point in the history
…licitly
  • Loading branch information
ArielG-NV authored Jun 7, 2024
2 parents d92292d + 7c6faf6 commit aaea056
Show file tree
Hide file tree
Showing 243 changed files with 3,589 additions and 1,152 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
compiler: gcc
platform: x64
config: debug
warnings-as-errors: false
warnings-as-errors: true
test-category: smoke
full-gpu-tests: false
runs-on: ubuntu-20.04
Expand Down
2 changes: 2 additions & 0 deletions build/visual-studio/slang/slang.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ IF EXIST ..\..\..\external\slang-glslang\bin\windows-aarch64\release\slang-glsla
<ClInclude Include="..\..\..\source\slang\slang-ir-metal-legalize.h" />
<ClInclude Include="..\..\..\source\slang\slang-ir-missing-return.h" />
<ClInclude Include="..\..\..\source\slang\slang-ir-obfuscate-loc.h" />
<ClInclude Include="..\..\..\source\slang\slang-ir-operator-shift-overflow.h" />
<ClInclude Include="..\..\..\source\slang\slang-ir-optix-entry-point-uniforms.h" />
<ClInclude Include="..\..\..\source\slang\slang-ir-peephole.h" />
<ClInclude Include="..\..\..\source\slang\slang-ir-propagate-func-properties.h" />
Expand Down Expand Up @@ -691,6 +692,7 @@ IF EXIST ..\..\..\external\slang-glslang\bin\windows-aarch64\release\slang-glsla
<ClCompile Include="..\..\..\source\slang\slang-ir-metal-legalize.cpp" />
<ClCompile Include="..\..\..\source\slang\slang-ir-missing-return.cpp" />
<ClCompile Include="..\..\..\source\slang\slang-ir-obfuscate-loc.cpp" />
<ClCompile Include="..\..\..\source\slang\slang-ir-operator-shift-overflow.cpp" />
<ClCompile Include="..\..\..\source\slang\slang-ir-optix-entry-point-uniforms.cpp" />
<ClCompile Include="..\..\..\source\slang\slang-ir-peephole.cpp" />
<ClCompile Include="..\..\..\source\slang\slang-ir-propagate-func-properties.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions build/visual-studio/slang/slang.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@
<ClInclude Include="..\..\..\source\slang\slang-ir-obfuscate-loc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\slang\slang-ir-operator-shift-overflow.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\slang\slang-ir-optix-entry-point-uniforms.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down Expand Up @@ -1157,6 +1160,9 @@
<ClCompile Include="..\..\..\source\slang\slang-ir-obfuscate-loc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\slang\slang-ir-operator-shift-overflow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\slang\slang-ir-optix-entry-point-uniforms.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/06-interfaces-generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void g<T:IFoo>()
Associated Types
-------------------------

When writing code using interfaces and generics, there are some situations where the an interface method needs to return an object whose type is implementation-dependent. For example, consider the following `IFloatContainer` interface that represents a container of `float` values:
When writing code using interfaces and generics, there are some situations where an interface method needs to return an object whose type is implementation-dependent. For example, consider the following `IFloatContainer` interface that represents a container of `float` values:
```csharp
// Represents a container of float values.
interface IFloatContainer
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/a1-02-slangpy.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ The second attribute `[AutoPyBindCUDA]` allows us to call `square` directly from

You can now simply invoke this kernel from python:

``` Python
```python
import torch
import slangtorch

Expand Down
2 changes: 1 addition & 1 deletion examples/hello-world/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int HelloWorldExample::createComputePipelineFromShader()
slang::SessionDesc sessionDesc = {};
slang::TargetDesc targetDesc = {};
targetDesc.format = SLANG_SPIRV;
targetDesc.profile = slangGlobalSession->findProfile("glsl440");
targetDesc.profile = slangGlobalSession->findProfile("spirv_1_5");
targetDesc.flags = SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY;

sessionDesc.targets = &targetDesc;
Expand Down
20 changes: 20 additions & 0 deletions slang.h
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ extern "C"
DisableShortCircuit, // bool
MinimumSlangOptimization, // bool
DisableNonEssentialValidations, // bool
DisableSourceMap, // bool

// Target

Expand Down Expand Up @@ -1574,6 +1575,16 @@ extern "C"

#define SLANG_UUID_ISlangWriter ISlangWriter::getTypeGuid()

struct ISlangProfiler : public ISlangUnknown
{
SLANG_COM_INTERFACE(0x197772c7, 0x0155, 0x4b91, { 0x84, 0xe8, 0x66, 0x68, 0xba, 0xff, 0x06, 0x19 })
virtual SLANG_NO_THROW size_t SLANG_MCALL getEntryCount() = 0;
virtual SLANG_NO_THROW const char* SLANG_MCALL getEntryName(uint32_t index) = 0;
virtual SLANG_NO_THROW long SLANG_MCALL getEntryTimeMS(uint32_t index) = 0;
virtual SLANG_NO_THROW uint32_t SLANG_MCALL getEntryInvocationTimes(uint32_t index) = 0;
};
#define SLANG_UUID_ISlangProfiler ISlangProfiler::getTypeGuid()

namespace slang {
struct IGlobalSession;
struct ICompileRequest;
Expand Down Expand Up @@ -2027,6 +2038,12 @@ extern "C"
SLANG_API SlangResult spEnableReproCapture(
SlangCompileRequest* request);

/*! @see slang::ICompileRequest::getCompileTimeProfile */
SLANG_API SlangResult spGetCompileTimeProfile(
SlangCompileRequest* request,
ISlangProfiler** compileTimeProfile,
bool shouldClear);


/** Extract contents of a repro.
Expand Down Expand Up @@ -4425,6 +4442,9 @@ namespace slang

virtual SLANG_NO_THROW void SLANG_MCALL setIgnoreCapabilityCheck(bool value) = 0;

// return a copy of internal profiling results, and if `shouldClear` is true, clear the internal profiling results before returning.
virtual SLANG_NO_THROW SlangResult SLANG_MCALL getCompileTimeProfile(ISlangProfiler** compileTimeProfile, bool shouldClear) = 0;

};

#define SLANG_UUID_ICompileRequest ICompileRequest::getTypeGuid()
Expand Down
28 changes: 25 additions & 3 deletions source/compiler-core/slang-metal-compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,33 @@ namespace Slang
static SlangResult locateMetalCompiler(const String& path, DownstreamCompilerSet* set)
{
ComPtr<IDownstreamCompiler> innerCppCompiler;
ExecutableLocation exeLocation(path, "metal");
SLANG_RETURN_ON_FAIL(GCCDownstreamCompilerUtil::createCompiler(exeLocation, innerCppCompiler));

ExecutableLocation metalcLocation = ExecutableLocation(path, "metal");;

String metalSDKPath = path;

#if defined (SLANG_APPLE_FAMILY)
// Use xcrun command to find the metal compiler.
CommandLine xcrunCmdLine;
ExecutableLocation xcrunLocation("xcrun");
xcrunCmdLine.setExecutableLocation(xcrunLocation);
xcrunCmdLine.addArg("--sdk");
xcrunCmdLine.addArg("macosx");
xcrunCmdLine.addArg("--find");
xcrunCmdLine.addArg("metal");
ExecuteResult exeRes;
if (SLANG_SUCCEEDED(ProcessUtil::execute(xcrunCmdLine, exeRes)))
{
String metalPath = exeRes.standardOutput.trim();
metalcLocation = ExecutableLocation(ExecutableLocation::Type::Path, metalPath);
metalSDKPath = Path::getParentDirectory(metalcLocation.m_pathOrName);
}
#endif

SLANG_RETURN_ON_FAIL(GCCDownstreamCompilerUtil::createCompiler(metalcLocation, innerCppCompiler));

ComPtr<IDownstreamCompiler> compiler = ComPtr<IDownstreamCompiler>(
new MetalDownstreamCompiler(innerCppCompiler, path));
new MetalDownstreamCompiler(innerCppCompiler, metalSDKPath));
set->addCompiler(compiler);
return SLANG_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion source/compiler-core/slang-source-map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void SourceMap::advanceToLine(Index nextLineIndex)
const auto lastEntryIndex = m_lineEntries.getCount();

// For all the new entries they will need to point to the end
m_lineStarts.setCount(nextLineIndex + 1);
m_lineStarts.growToCount(nextLineIndex + 1);

Index* starts = m_lineStarts.getBuffer();
for (Index i = currentLineIndex + 1; i < nextLineIndex + 1; ++i)
Expand Down
Loading

0 comments on commit aaea056

Please sign in to comment.