Skip to content

Commit 4872eeb

Browse files
authored
Don't add multiple matrix layout options when creating a session (#6476)
The default matrix layout mode was applied in addition to any related options, and this caused the wrong matrix layout mode to be used. For example, tests/compute/column-major was failing when attempting to migrate to the new compilation API. This helps to address issue #4760
1 parent 33706fd commit 4872eeb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

source/slang/slang.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,6 @@ Session::createSession(slang::SessionDesc const& inDesc, slang::ISession** outSe
816816
new TypeCheckingCache(*static_cast<TypeCheckingCache*>(m_typeCheckingCache.get()));
817817
}
818818

819-
linkage->setMatrixLayoutMode(desc.defaultMatrixLayoutMode);
820-
821819
Int searchPathCount = desc.searchPathCount;
822820
for (Int ii = 0; ii < searchPathCount; ++ii)
823821
{
@@ -845,6 +843,10 @@ Session::createSession(slang::SessionDesc const& inDesc, slang::ISession** outSe
845843

846844
linkage->m_optionSet.load(desc.compilerOptionEntryCount, desc.compilerOptionEntries);
847845

846+
if (!linkage->m_optionSet.hasOption(CompilerOptionName::MatrixLayoutColumn) &&
847+
!linkage->m_optionSet.hasOption(CompilerOptionName::MatrixLayoutRow))
848+
linkage->setMatrixLayoutMode(desc.defaultMatrixLayoutMode);
849+
848850
{
849851
const Int targetCount = desc.targetCount;
850852
const uint8_t* targetDescPtr = reinterpret_cast<const uint8_t*>(desc.targets);

0 commit comments

Comments
 (0)