Skip to content

Commit

Permalink
Merge branch 'update_diag_entry_allowed_on_stage' of https://github.c…
Browse files Browse the repository at this point in the history
…om/bob80905/DirectXShaderCompiler into update_diag_entry_allowed_on_stage
  • Loading branch information
bob80905 committed Nov 9, 2023
2 parents 1a3997c + 5960747 commit 2691a7c
Show file tree
Hide file tree
Showing 39 changed files with 463 additions and 232 deletions.
9 changes: 5 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ stages:
configuration: Release
CC: clang
CXX: clang++
CMAKE_OPTS: -DLLVM_ENABLE_WERROR=On -DLLVM_ENABLE_SANITIZER=Address -DLLVM_ENABLE_LIBCXX=On
CMAKE_OPTS: -DLLVM_ENABLE_WERROR=On -DLLVM_USE_SANITIZER=Address,Undefined -DLLVM_ENABLE_LIBCXX=On -DLLVM_USE_LINKER=lld
CHECK_ALL_ENV: ASAN_OPTIONS=alloc_dealloc_mismatch=0
OS: Linux
Linux_Clang_Debug:
image: ${{ variables.linux }}
configuration: Debug
CC: clang
CXX: clang++
CMAKE_OPTS: -DLLVM_ENABLE_WERROR=On
CMAKE_OPTS: -DLLVM_ENABLE_WERROR=On -DLLVM_USE_LINKER=lld
Linux_Gcc_Release:
image: ${{ variables.linux }}
configuration: Release
Expand Down Expand Up @@ -104,7 +105,7 @@ stages:
displayName: 'Installing dependencies'
condition: eq(variables['image'], variables['macOS'])
- bash: |
cmake -B build -G Ninja $BUILD_SOURCESDIRECTORY -DLLVM_LIT_ARGS=--xunit-xml-output=testresults.xunit.xml -C $BUILD_SOURCESDIRECTORY/cmake/caches/PredefinedParams.cmake -DSPIRV_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=$(configuration) -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) $(CMAKE_OPTS)
cmake -B build -G Ninja $BUILD_SOURCESDIRECTORY -DLLVM_LIT_ARGS='-v --xunit-xml-output=testresults.xunit.xml' -C $BUILD_SOURCESDIRECTORY/cmake/caches/PredefinedParams.cmake -DSPIRV_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=$(configuration) -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) $(CMAKE_OPTS)
displayName: 'Running Cmake'
- bash: |
ninja -C build test-depends
Expand All @@ -116,7 +117,7 @@ stages:
ls -ld $AGENT_BUILDDIRECTORY
ls -ld $BUILD_SOURCESDIRECTORY
displayName: 'Smoke tests'
- bash: ninja -C build check-all
- bash: $(CHECK_ALL_ENV) ninja -C build check-all
displayName: 'DXC tests'
- task: PublishTestResults@2
inputs:
Expand Down
2 changes: 1 addition & 1 deletion docs/DXIL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3023,7 +3023,7 @@ DECL.NODELAUNCHINPUTTYPE Invalid input record type for node lau
DECL.NOTUSEDEXTERNAL External declaration should not be used
DECL.PARAMSTRUCT Callable function parameter must be struct type
DECL.PAYLOADSTRUCT Payload parameter must be struct type
DECL.RAYQYERYINFNSIG Rayquery objects not allowed in function signatures
DECL.RAYQUERYINFNSIG Rayquery objects not allowed in function signatures
DECL.RESOURCEINFNSIG Resources not allowed in function signatures
DECL.SHADERMISSINGARG payload/params/attributes parameter is required for certain shader types
DECL.SHADERRETURNVOID Shader functions must return void
Expand Down
10 changes: 5 additions & 5 deletions include/dxc/DxilContainer/RDAT_LibraryTypes.inl
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
#ifdef DEF_RDAT_ENUMS

RDAT_ENUM_START(DxilResourceFlag, uint32_t)
RDAT_ENUM_VALUE(None, 0)
RDAT_ENUM_VALUE(UAVGloballyCoherent, 1 << 0)
RDAT_ENUM_VALUE(UAVCounter, 1 << 1)
RDAT_ENUM_VALUE(None, 0)
RDAT_ENUM_VALUE(UAVGloballyCoherent, 1 << 0)
RDAT_ENUM_VALUE(UAVCounter, 1 << 1)
RDAT_ENUM_VALUE(UAVRasterizerOrderedView, 1 << 2)
RDAT_ENUM_VALUE(DynamicIndexing, 1 << 3)
RDAT_ENUM_VALUE(Atomics64Use, 1 << 4)
RDAT_ENUM_VALUE(DynamicIndexing, 1 << 3)
RDAT_ENUM_VALUE(Atomics64Use, 1 << 4)
RDAT_ENUM_END()

#endif // DEF_RDAT_ENUMS
Expand Down
6 changes: 3 additions & 3 deletions include/dxc/DxilContainer/RDAT_SubobjectTypes.inl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RDAT_DXIL_ENUM_START(hlsl::DXIL::SubobjectKind, uint32_t)
RDAT_ENUM_VALUE_NODEF(HitGroup)
RDAT_ENUM_VALUE_NODEF(RaytracingPipelineConfig1)
// No need to define this here
// RDAT_ENUM_VALUE_NODEF(NumKinds)
//RDAT_ENUM_VALUE_NODEF(NumKinds)
#if DEF_RDAT_ENUMS == DEF_RDAT_DUMP_IMPL
static_assert((unsigned)hlsl::DXIL::SubobjectKind::NumKinds == 13,
"otherwise, RDAT_DXIL_ENUM definition needs updating");
Expand All @@ -46,8 +46,8 @@ RDAT_DXIL_ENUM_START(hlsl::DXIL::StateObjectFlags, uint32_t)
RDAT_ENUM_VALUE_NODEF(AllowExternalDependenciesOnLocalDefinitions)
RDAT_ENUM_VALUE_NODEF(AllowStateObjectAdditions)
// No need to define these masks here
// RDAT_ENUM_VALUE_NODEF(ValidMask_1_4)
// RDAT_ENUM_VALUE_NODEF(ValidMask)
//RDAT_ENUM_VALUE_NODEF(ValidMask_1_4)
//RDAT_ENUM_VALUE_NODEF(ValidMask)
#if DEF_RDAT_ENUMS == DEF_RDAT_DUMP_IMPL
static_assert((unsigned)hlsl::DXIL::StateObjectFlags::ValidMask == 0x7,
"otherwise, RDAT_DXIL_ENUM definition needs updating");
Expand Down
1 change: 0 additions & 1 deletion include/dxc/HLSL/HLOperations.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ const unsigned kSampleCmpOffsetArgIndex = 5;
const unsigned kSampleCmpClampArgIndex = 6;
const unsigned kSampleCmpStatusArgIndex = 7;


// SampleCmpBias.
const unsigned kSampleCmpBCmpValArgIndex = 4;
const unsigned kSampleCmpBBiasArgIndex = 5;
Expand Down
7 changes: 4 additions & 3 deletions include/dxc/Support/HLSLOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ struct RewriterOpts {
};

enum class ValidatorSelection : int {
Auto, // Try DXIL.dll; fallback to internal validator
Internal, // Force internal validator (even if DXIL.dll is present)
External // Use DXIL.dll, failing compilation if not available
Auto, // Try DXIL.dll; fallback to internal validator
Internal, // Force internal validator (even if DXIL.dll is present)
External, // Use DXIL.dll, failing compilation if not available
Invalid = -1 // Invalid
};

/// Use this class to capture all options.
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/InitializePasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ void initializeLowerStaticGlobalIntoAllocaPass(PassRegistry&);
void initializeDynamicIndexingVectorToArrayPass(PassRegistry&);
void initializeMultiDimArrayToOneDimArrayPass(PassRegistry&);
void initializeResourceToHandlePass(PassRegistry&);
void initializeLowerWaveMatTypePass(PassRegistry&);
void initializeLowerWaveMatTypePass(PassRegistry &);
void initializeSROA_SSAUp_HLSLPass(PassRegistry&);
void initializeHoistConstantArrayPass(PassRegistry&);
void initializeDxilLoopUnrollPass(PassRegistry&);
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/Transforms/Scalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void initializeResourceToHandlePass(PassRegistry&);
// Flatten resource into handle.
//
ModulePass *createLowerWaveMatTypePass();
void initializeLowerWaveMatTypePass(PassRegistry&);
void initializeLowerWaveMatTypePass(PassRegistry &);

//===----------------------------------------------------------------------===//
// Hoist a local array initialized with constant values to a global array with
Expand Down
10 changes: 0 additions & 10 deletions lib/DXIL/DxilUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,6 @@ bool IsHLSLResourceDescType(llvm::Type *Ty) {
return false;
StringRef name = ST->getName();

ConsumePrefix(name, "class.");
ConsumePrefix(name, "struct.");

// TODO: don't check names.
Expand All @@ -645,7 +644,6 @@ bool IsHLSLNodeOutputType(llvm::Type *Ty) {
return false;
StringRef name = ST->getName();

ConsumePrefix(name, "class.");
ConsumePrefix(name, "struct.");

// TODO: don't check names.
Expand All @@ -661,7 +659,6 @@ bool IsHLSLNodeOutputArrayType(llvm::Type *Ty) {
return false;
StringRef name = ST->getName();

ConsumePrefix(name, "class.");
ConsumePrefix(name, "struct.");

// TODO: don't check names.
Expand All @@ -678,7 +675,6 @@ bool IsHLSLEmptyNodeOutputType(llvm::Type *Ty) {
return false;
StringRef name = ST->getName();

ConsumePrefix(name, "class.");
ConsumePrefix(name, "struct.");

// TODO: don't check names.
Expand All @@ -694,7 +690,6 @@ bool IsHLSLEmptyNodeOutputArrayType(llvm::Type *Ty) {
return false;
StringRef name = ST->getName();

ConsumePrefix(name, "class.");
ConsumePrefix(name, "struct.");

// TODO: don't check names.
Expand All @@ -710,7 +705,6 @@ bool IsHLSLNodeInputRecordType(llvm::Type *Ty) {
return false;
StringRef name = ST->getName();

ConsumePrefix(name, "class.");
ConsumePrefix(name, "struct.");

// TODO: don't check names.
Expand All @@ -732,7 +726,6 @@ bool IsHLSLNodeEmptyInputRecordType(llvm::Type *Ty) {
return false;
StringRef name = ST->getName();

ConsumePrefix(name, "class.");
ConsumePrefix(name, "struct.");

// TODO: don't check names.
Expand All @@ -748,7 +741,6 @@ bool IsHLSLNodeEmptyOutputRecordType(llvm::Type *Ty) {
return false;
StringRef name = ST->getName();

ConsumePrefix(name, "class.");
ConsumePrefix(name, "struct.");

// TODO: don't check names.
Expand All @@ -764,7 +756,6 @@ bool IsHLSLRWNodeInputRecordType(llvm::Type *Ty) {
return false;
StringRef name = ST->getName();

ConsumePrefix(name, "class.");
ConsumePrefix(name, "struct.");

if (name.startswith("RWDispatchNodeInputRecord<") ||
Expand All @@ -781,7 +772,6 @@ bool IsHLSLNodeOutputRecordType(llvm::Type *Ty) {
return false;
StringRef name = ST->getName();

ConsumePrefix(name, "class.");
ConsumePrefix(name, "struct.");

// TODO: don't check names.
Expand Down
1 change: 0 additions & 1 deletion lib/DXIL/DxilWaveMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"


using namespace llvm;

namespace hlsl {
Expand Down
13 changes: 6 additions & 7 deletions lib/DxcSupport/HLSLOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,13 +975,12 @@ int ReadDxcOpts(const OptTable *optionTable, unsigned flagsToInclude,

llvm::StringRef valSelectStr = Args.getLastArgValue(OPT_select_validator);
if (!valSelectStr.empty()) {
if (valSelectStr.equals_lower("auto")) {
opts.SelectValidator = ValidatorSelection::Auto;
} else if (valSelectStr.equals_lower("internal")) {
opts.SelectValidator = ValidatorSelection::Internal;
} else if (valSelectStr.equals_lower("external")) {
opts.SelectValidator = ValidatorSelection::External;
} else {
opts.SelectValidator = llvm::StringSwitch<ValidatorSelection>(valSelectStr)
.Case("auto", ValidatorSelection::Auto)
.Case("internal", ValidatorSelection::Internal)
.Case("external", ValidatorSelection::External)
.Default(ValidatorSelection::Invalid);
if (opts.SelectValidator == ValidatorSelection::Invalid) {
errors << "Unsupported value '" << valSelectStr
<< "for -select-validator option.";
return 1;
Expand Down
8 changes: 4 additions & 4 deletions lib/Transforms/Utils/Local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"

#include "dxc/DXIL/DxilInstructions.h" // HLSL Change - DxilInst_OutputComplete usage
#include "dxc/DXIL/DxilMetadataHelper.h" // HLSL Change - combine dxil metadata.
#include "dxc/DXIL/DxilOperations.h" // HLSL Change - Get HLSL Opcodes
#include "dxc/DXIL/DxilUtil.h" // HLSL Change - special handling of convergent marker
#include "dxc/DXIL/DxilInstructions.h" // HLSL Change - DxilInst_OutputComplete usage
#include "dxc/DXIL/DxilOperations.h" // HLSL Change - Get HLSL Opcodes

using namespace llvm;

Expand Down Expand Up @@ -336,9 +336,9 @@ bool llvm::isInstructionTriviallyDead(Instruction *I,
return C->isNullValue() || isa<UndefValue>(C);

// HLSL Change - Verify that function has no side effects
if (hlsl::dxilutil::FunctionHasNoSideEffects(I))
if (hlsl::dxilutil::FunctionHasNoSideEffects(I))
return true;

// HLSL Change End

return false;
Expand Down
3 changes: 0 additions & 3 deletions test/DXILValidation/lit.local.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,6 @@ else:
# also have a post-assertion to not match a trailing hyphen (foo-).
NOJUNK = r"(?<!\.|-|\^|/)"

config.substitutions.append( ('%dxv',
lit.util.which('dxv', llvm_tools_dir)) )

# HLSL Change begin - disabling tools we don't build
for pattern in [#r"\bbugpoint\b(?!-)",
#NOJUNK + r"\bllc\b",
Expand Down
97 changes: 49 additions & 48 deletions tools/clang/include/clang/Basic/DiagnosticIDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,57 +26,58 @@ namespace clang {
// Import the diagnostic enums themselves.
namespace diag {
// Start position for diagnostics.
enum {
DIAG_START_COMMON = 0,
DIAG_START_DRIVER = DIAG_START_COMMON + 300,
DIAG_START_FRONTEND = DIAG_START_DRIVER + 100,
DIAG_START_SERIALIZATION = DIAG_START_FRONTEND + 100,
DIAG_START_LEX = DIAG_START_SERIALIZATION + 120,
DIAG_START_PARSE = DIAG_START_LEX + 300,
DIAG_START_AST = DIAG_START_PARSE + 500,
DIAG_START_COMMENT = DIAG_START_AST + 110,
DIAG_START_SEMA = DIAG_START_COMMENT + 100,
// HLSL Change: SEMA group length increased from 3000.
DIAG_START_ANALYSIS = DIAG_START_SEMA + 3100,
DIAG_UPPER_LIMIT = DIAG_START_ANALYSIS + 100
};

class CustomDiagInfo;

/// \brief All of the diagnostics that can be emitted by the frontend.
typedef unsigned kind;

// Get typedefs for common diagnostics.
enum {
#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\
SFINAE,CATEGORY,NOWERROR,SHOWINSYSHEADER) ENUM,
enum {
DIAG_START_COMMON = 0,
DIAG_START_DRIVER = DIAG_START_COMMON + 300,
DIAG_START_FRONTEND = DIAG_START_DRIVER + 100,
DIAG_START_SERIALIZATION = DIAG_START_FRONTEND + 100,
DIAG_START_LEX = DIAG_START_SERIALIZATION + 120,
DIAG_START_PARSE = DIAG_START_LEX + 300,
DIAG_START_AST = DIAG_START_PARSE + 500,
DIAG_START_COMMENT = DIAG_START_AST + 110,
DIAG_START_SEMA = DIAG_START_COMMENT + 100,
// HLSL Change: SEMA group length increased from 3000.
DIAG_START_ANALYSIS = DIAG_START_SEMA + 3100,
DIAG_UPPER_LIMIT = DIAG_START_ANALYSIS + 100
};

class CustomDiagInfo;

/// \brief All of the diagnostics that can be emitted by the frontend.
typedef unsigned kind;

// Get typedefs for common diagnostics.
enum {
#define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, CATEGORY, \
NOWERROR, SHOWINSYSHEADER) \
ENUM,
#define COMMONSTART
#include "clang/Basic/DiagnosticCommonKinds.inc"
NUM_BUILTIN_COMMON_DIAGNOSTICS
NUM_BUILTIN_COMMON_DIAGNOSTICS
#undef DIAG
};

/// Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs
/// to either Ignore (nothing), Remark (emit a remark), Warning
/// (emit a warning) or Error (emit as an error). It allows clients to
/// map ERRORs to Error or Fatal (stop emitting diagnostics after this one).
enum class Severity {
// NOTE: 0 means "uncomputed".
Ignored = 1, ///< Do not present this diagnostic, ignore it.
Remark = 2, ///< Present this diagnostic as a remark.
Warning = 3, ///< Present this diagnostic as a warning.
Error = 4, ///< Present this diagnostic as an error.
Fatal = 5 ///< Present this diagnostic as a fatal error.
};

/// Flavors of diagnostics we can emit. Used to filter for a particular
/// kind of diagnostic (for instance, for -W/-R flags).
enum class Flavor {
WarningOrError, ///< A diagnostic that indicates a problem or potential
///< problem. Can be made fatal by -Werror.
Remark ///< A diagnostic that indicates normal progress through
///< compilation.
};
};

/// Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs
/// to either Ignore (nothing), Remark (emit a remark), Warning
/// (emit a warning) or Error (emit as an error). It allows clients to
/// map ERRORs to Error or Fatal (stop emitting diagnostics after this one).
enum class Severity {
// NOTE: 0 means "uncomputed".
Ignored = 1, ///< Do not present this diagnostic, ignore it.
Remark = 2, ///< Present this diagnostic as a remark.
Warning = 3, ///< Present this diagnostic as a warning.
Error = 4, ///< Present this diagnostic as an error.
Fatal = 5 ///< Present this diagnostic as a fatal error.
};

/// Flavors of diagnostics we can emit. Used to filter for a particular
/// kind of diagnostic (for instance, for -W/-R flags).
enum class Flavor {
WarningOrError, ///< A diagnostic that indicates a problem or potential
///< problem. Can be made fatal by -Werror.
Remark ///< A diagnostic that indicates normal progress through
///< compilation.
};
}

class DiagnosticMapping {
Expand Down
5 changes: 2 additions & 3 deletions tools/clang/lib/CodeGen/CGDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1078,9 +1078,8 @@ bool CGDebugInfo::TryCollectHLSLRecordElements(const RecordType *Ty,
}

return true;
}
else if (hlsl::IsHLSLResourceType(QualTy) || hlsl::IsHLSLNodeType(QualTy) ||
hlsl::IsHLSLStreamOutputType(QualTy)) {
} else if (hlsl::IsHLSLResourceType(QualTy) || hlsl::IsHLSLNodeType(QualTy) ||
hlsl::IsHLSLStreamOutputType(QualTy)) {
// Should appear as having no members rather than exposing our internal handles.
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion tools/clang/lib/CodeGen/CGHLSLMSFinishCodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ void AddAnnotateWaveMatrix(HLModule &HLM,
IRBuilder<> Builder(dxilutil::FindAllocaInsertionPt(Arg->getParent()));
CreateAnnotateWaveMatrix(HLM, V, WMP, Builder);
} else {
DXASSERT(false, "WaveMatrix value is unexpected type");
llvm_unreachable("WaveMatrix value is unexpected type");
}
}
}
Expand Down
Loading

0 comments on commit 2691a7c

Please sign in to comment.