Add HLSL support through DXC#511
Conversation
|
Hm, cleaned out my third_party/dxc and this is failing to link again.....will take a look. |
|
This requires a patch to DXC in order to build: We'll probably want to make that change contingent on BUILD_SHARED_LIBS being off or LLVM_BUILD_STATIC being on |
|
|
||
| DXC can be enabled in Amber by adding the `-DAMBER_USE_DXC=true` flag when | ||
| running cmake. | ||
|
|
There was a problem hiding this comment.
Should say that this also enables HLSL shader support, and that DXC is used to compile those shaders.
There was a problem hiding this comment.
Although we would also need updates to the vk_script and amberscript docs. So I'll file an issue for that.
There was a problem hiding this comment.
I have no plans on updating vkscript to support hlsl. This will be AmberScript only.
| if (compiler->Compile(source, /* source text */ | ||
| src_filename.c_str(), /* original file source */ | ||
| std::wstring(entry.begin(), entry.end()) | ||
| .c_str(), /* entry point name */ |
There was a problem hiding this comment.
I had to stop for a while, worrying about the lifetime of the temporary. But it dies at the end of the full expression, so that's late enough. Phew.
There was a problem hiding this comment.
Heh, I didn't think about that at the time.
| #include <algorithm> | ||
| #include <sstream> | ||
|
|
||
| #include "third_party/dxc/include/dxc/Support/Global.h" |
There was a problem hiding this comment.
This seems over-descriptive. In future we should allow DXC's source to be in some configurable location. But that's for the future.
There was a problem hiding this comment.
Include paths should be from the root src/ directory. Or are you thinking we should allow DXC to live outside amber?
There was a problem hiding this comment.
I mean DXC should be able to live outside of Amber. Like, if I had one giant build tree that included many tools for the Vulkan shader stack.
So, I'd have
#include "dxc/Support/Global.h"
so that I can always find with a -I option on the compiler, where that is controlled from a CMake string expression.
Right, we'll need that change before we can land this. |
|
It looks like on windows we always want to build DXCompiler as SHARED. Building as STATIC doesn't seem to link for me.... |
This Cl adds DXC to the Amber third_party directory and enables using HLSL as the shader language in AmberScript. Fixes #34
|
Note, this no longer requires any changes into DXC to work. So, it should be good to land once bots + reviewers are happy. |
| # This has to be done very early so the link path will get set correctly for all | ||
| # the various libraries and binaries. | ||
| if (${AMBER_ENABLE_DXC}) | ||
| link_directories("${CMAKE_BINARY_DIR}/third_party/dxc/lib") |
There was a problem hiding this comment.
For later: We can use <projectname>_BINARY_DIR to specify this dir, without assuming its source was under third_party.
It's kind of weird, but DXC sets the project name to "LLVM", so then it would still look weird!
See https://github.com/microsoft/DirectXShaderCompiler/blob/master/CMakeLists.txt#L28
|
|
||
| if (${AMBER_ENABLE_DXC}) | ||
| target_include_directories(libamber PRIVATE | ||
| "${PROJECT_SOURCE_DIR}/third_party/dxc/include" |
There was a problem hiding this comment.
Similarly, this could be ${LLVM_SOURCE_DIR}/include and ${LLVM_BINARY_DIR}/include
Roll third_party/clspv/ d4fab77af..bbbda97e8 (5 commits) google/clspv@d4fab77...bbbda97 $ git log d4fab77af..bbbda97e8 --date=short --no-merges --format='%ad %ae %s' 2020-03-03 kpet Add support for get_work_dim() and global offset (#514) 2020-03-02 dneto Avoid Pythopn distutils.dir_util (#515) 2020-02-25 alanbaker Array images (#511) 2020-02-24 alanbaker Update deps (#512) 2020-02-20 alanbaker Generate OpImageFetch for unsampled reads (#503) Roll third_party/clspv-llvm/ fa221fc6b..1bedb2340 (1058 commits) llvm/llvm-project@fa221fc...1bedb23 $ git log fa221fc6b..1bedb2340 --date=short --no-merges --format='%ad %ae %s' 2020-03-03 jpienaar [mlir][ods] Add query for derived attribute 2020-03-03 sstipanovic Revert "Revert "[lldb/Docs] Mark both Python 3.6 and 3.8 as supported on Windows"" 2020-03-03 sstipanovic Revert "[OpenMP] Adding InaccessibleMemOnly and InaccessibleMemOrArgMemOnly for runtime calls." 2020-03-03 sstipanovic Revert "[lldb/Docs] Mark both Python 3.6 and 3.8 as supported on Windows" 2020-03-03 sstipanovic [OpenMP] Adding InaccessibleMemOnly and InaccessibleMemOrArgMemOnly for runtime calls. 2020-03-03 jonas [lldb/Docs] Mark both Python 3.6 and 3.8 as supported on Windows 2020-03-03 a.bataev [OPENMP50]Support 'update' clause for 'depobj' directive. 2020-03-03 teemperor [lldb][NFC] Remove some commented out code in TypeSystemClang 2020-03-03 craig.topper [X86] Always emit an integer vbroadcast_load from lowerBuildVectorAsBroadcast regardless of AVX vs AVX2 2020-03-03 craig.topper [X86] Directly emit VBROADCAST_LOAD from constant pool in lowerBuildVectorAsBroadcast 2020-03-03 llvmgnsyncbot [gn build] Port c84532a70aa 2020-03-03 whitneyt [LoopNest]: Analysis to discover properties of a loop nest. 2020-03-03 jonathanchesterfield [libomptarget][nfc][amdgcn] Simplify assert_fail implementation 2020-03-03 maskray [Bitcode] Fix -Wswitch after c5ec8890c95bf9f56beff285efbcc7b797ffb15a 2020-03-03 craig.topper [X86] Connect accidentally dead code in a avx512 fmadd intrinsic test case. 2020-03-03 mail Restore `REQUIRES: default_triple` to a test 2020-03-03 jbcoe [clang-format] Allow nested [] in C# attributes 2020-03-03 lhames [ORC] Make sure we add initializers to the SymbolFlags map for objects. 2020-03-03 lhames [ORC] Remove an out-of-date FIXME 2020-03-03 zinenko [mlir] support reductions in loop to std conversion 2020-03-02 saugustine Promote nameless lambda used by dl_iterate_phdr to named function to clean up control flow inside findUnwindSections. Also, expose the data structure to allow use by a future replacment function. 2020-02-27 maskray [MCDwarf] Generate DWARF v5 .debug_rnglists for assembly files 2020-03-03 tyker1 [NFC] Try fix ubsan buildbot after 876d13378931bee3dcefafff8729c40d5457ff31 2020-03-03 joerg Add module for llvm/Bitstream 2020-03-03 n.james93 [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-02 pierre.vanhoutryve [debuginfo-tests][dexter] Add --builder gcc support for POSIX 2020-03-03 craig.topper [DAGCombiner][X86] Improve narrowExtractedVectorLoad to handle cases where the element size isn't byte sized by the subvector is. 2020-03-02 craig.topper [X86] Don't count the chain uses when forming broadcast loads in lowerBuildVectorAsBroadcast. 2020-03-03 cebowleratibm [PowerPC][NFC] Add missing expected output for AIX int stack arg test. 2020-03-03 cebowleratibm [PowerPC][NFC] Lexically order expected output for AIX stack arg test. 2020-03-03 zinenko [mlir] ExecutionEngine: fix assertion on the error path 2020-03-02 zinenko [mlir] error out on unsupported attribute kinds in LLVM global translation 2020-03-03 llvmgnsyncbot [gn build] Port ae4d39c9e4a 2020-02-20 paulsson [SystemZ] Copy Access registers and CC with the correct register class. 2020-03-03 pavel [lldb] Add detailed tests for the "disassemble" command 2020-03-02 francesco.petrogalli [llvm][CodeGen][SVE] Constrain prefetch intrinsic argument to immediate values. 2020-03-03 sam.parker [RDA][ARM] collectKilledOperands across multiple blocks 2020-03-03 sam.mccall [clangd] Propagate versions into DraftStore, assigning where missing. NFC 2020-02-27 sam.parker [ARM][RDA] Allow multiple killed users 2020-03-03 digger.llvm [AIX][XCOFF] Fix XCOFFObjectWriter assertion failure with alignment-related gap and improve text section output testing 2020-02-21 sidneym [hexagon] Add default paths to support musl target 2020-03-03 pifon [MLIR] Add explicit initial values for loop.parallel op. 2020-03-02 ntv [mlir] Add padding to 1-D Vector in CRunnerUtils.h 2020-03-02 ntv [mlir] Hotfix - Fix Windows build 2020-03-03 llvmgnsyncbot [gn build] Port 613f791131e 2020-03-03 benny.kra [llvm-ar] Remove unused variable. NFC. 2020-03-03 courbet [ExpandMemCmp][NFC] Regenerate tests. 2020-03-03 whitneyt Revert "[LoopNest]: Analysis to discover properties of a loop nest." 2020-02-27 paulsson [SystemZ] Bugfix for backchain with packed-stack 2020-03-03 courbet [ExpandMemCmp] Add more tests to show missing constant folding. (...) 2020-01-28 efriedma [SVE] Add support for lowering GEPs involving scalable vectors. 2020-02-20 Scott.Linder [Driver] Escape the program path for -frecord-command-line 2020-02-20 syaghmour [ASTImporter] Add linkage check to ASTNodeImporter::hasSameVisibilityContext and rename to hasSameVisibilityContextAndLinkage 2020-02-20 daltenty [AIX] Improve 32/64-bit build configuration 2020-02-20 craig.topper Recommit "[X86] Replace a bad use of MVT::getVectorVT with EVT::getVectorVT"" 2020-02-20 craig.topper Revert 714265dabb606bfef2f85694234f152edbfa91ac "[X86] Replace a bad use of MVT::getVectorVT with EVT::getVectorVT" 2020-02-20 qcolombet [X86] Replace a bad use of MVT::getVectorVT with EVT::getVectorVT 2020-02-20 thakis Revert "libclang: Add static build support for Windows" and follow-up "libclang: Make shared object symbol exporting by default" 2020-02-20 thakis Revert "[AArch64][SVE] Add intrinsics for SVE2 bitwise ternary operations" 2020-02-20 spatel [ConstantFold] add/move tests for FP with undef operand; NFC 2020-02-21 SourabhSingh.Tomar Revert "[NFCI][DebugInfo]: Corrected a Typo." 2020-02-20 francesco.petrogalli [llvm][build] Fix shared lib builds. [NFC] 2020-02-20 richard [cxx_status] Update -std= instructions for C++20. 2020-02-20 qcolombet [GISel][KnownBits] Give up on PHI analysis as soon as we don't know anything 2020-02-17 jkorous [clang][doxygen] Fix false -Wdocumentation warning for tag typedefs 2020-02-20 daltenty [AIX] Pack BasicBlockBits 2020-02-20 cristian.adam libclang: Make shared object symbol exporting by default 2020-02-20 jbcoe [clang-format] Merge name and colon into a single token for C# named arguments 2020-02-20 llvm-dev [X86] Fix NSW/NUW typo in avg test (PR44973) 2020-02-20 lhames [ORC] Add a convenience method for setting the ExecutionSession to LLJITBuilder. 2020-02-20 lhames [ORC][examples] Fix ThinLtoJIT example after changes in 85fb997659b. 2020-02-20 kramm Fix some typos in the MLIR documentation. 2020-02-20 alexbrachetmialot [libc] Add Initial Support for Signals 2020-02-20 spatel [x86] allow peeking through an extract_subvector to find a splatted operand 2020-02-20 sd.fertile [PowerPC][NFC] Cleanup some of the Darwin mentions in the README.txt. 2020-02-20 francisvm Revert "[macho][NFC] Extract all CPU_(SUB_)TYPE logic to libObject" 2020-02-20 riddleriver [mlir] Refactor the structure of the 'verifyConstructionInvariants' methods. 2020-02-18 francisvm [macho][NFC] Extract all CPU_(SUB_)TYPE logic to libObject 2020-02-20 llvm-dev [DAGCombiner] Use SDValue::getConstantOperandAPInt helper where possible. NFC. 2020-02-19 rupprecht [lldb] Fix version string when using LLDB_REVISION but not LLDB_REPOSITORY 2020-02-20 omair.javaid Add target.xml support for qXfer request. 2020-02-20 ldionne [clang] Fix search path logic for C_INCLUDE_DIRS 2020-02-20 craig.topper [X86] Fix a -Wparentheses warning. NFC 2020-02-20 eugene.zelenko [clang-tidy] rename_check.py: maintain alphabetical order in Renamed checks section 2020-02-20 logan.r.smith0 [libc++] Fix unqualified call to 'ref' inside shared_ptr(unique_ptr<U, D>) 2020-02-20 logan.r.smith0 [libc++] Fix unintended ADL inside ref(reference_wrapper<T>) and cref(reference_wrapper<T>) 2020-02-20 craig.topper [X86] Rewrite LowerBRCOND to remove dead code and handle ISD::SETCC and overflow ops directly. 2020-02-20 craig.topper [AArch64] Move isOverflowIntrOpRes help function to the ISD namespace in SelectionDAG.h. NFC 2020-02-20 spatel [x86] add vector tests for splatted memory ops; NFC 2020-02-20 danilo.carvalho.grael [AArch64][SVE] Add intrinsics for SVE2 bitwise ternary operations 2020-02-20 craig.topper [X86] Add DAG combines to form CVTPH2PS/CVTPS2PH from vXf16->vXf32/vXf64 fp_extends and vXf32->vXf16 fp_round. 2020-02-20 usx [clang][analyzer] Modify include AllocationState.h in PutenvWithAutoChecker.cpp 2020-02-20 llvm-dev [DAGCombine] visitEXTRACT_VECTOR_ELT - add SimplifyDemandedBits multi use support 2020-02-20 hans Add #include <condition_variable> to fix build after 85fb997659b5 2020-02-20 spatel [x86] regenerate test checks with less shuffle scrubbing; NFC 2020-02-20 sd.fertile [PowerPC][NFC] We do not save/restore vrsave for any remaining subtargets. 2020-02-20 sam.parker [NFC][RDA] Break-up initialization code 2020-02-20 Matthew.Arsenault AMDGPU: Fix v2i64<->v4f32 bitcast 2020-02-20 spatel [Utils][x86] add an option to reduce scrubbing of shuffles with memops 2020-02-13 sebastian.neubauer [AMDGPU] Don’t marke the .note section as ALLOC Roll third_party/dxc/ 409822958..ed6b888f1 (11 commits) microsoft/DirectXShaderCompiler@4098229...ed6b888 $ git log 409822958..ed6b888f1 --date=short --no-merges --format='%ad %ae %s' 2020-03-03 hekotas Update version to 1.5.2003 (#2734) 2020-03-03 31109344+adam-yang Added instructions to preserve intermediate values of computations. (#2721) 2020-03-02 jeffno User/jeffnn/pix dontoverwriteoffsetcounter (#2729) 2020-03-01 texr Rename 'module' to 'hModule' for C++20 compat (#2667) 2020-02-28 jaebaek [spirv] update spirv-tools and spirv-headers (#2723) 2020-02-27 texr Fix /Odump test and file cleanup in hcttestcmds.cmd (#2719) 2020-02-25 grroth Update dndxc to modern versions (#2722) 2020-02-25 jpporto Adds the DxcPixDxilDebugInfo interface and friends. (#2715) 2020-02-25 texr Fix outputs -Fre, -Fsh, -Frs, and -Fc with -Fh (#2716) 2020-02-21 jeffno Pix mesh shader output instrumentation (#2709) 2020-02-20 jpporto Adds pass for converting calls to dbg.value to dbg.declare (#2706) Roll third_party/glslang/ c12493ff6..8985fc910 (9 commits) KhronosGroup/glslang@c12493f...8985fc9 $ git log c12493ff6..8985fc910 --date=short --no-merges --format='%ad %ae %s' 2020-03-03 cepheus Fix long lines in the SPIR-V generator, retrigger bots. 2020-03-03 cepheus Fix #1843: Handle built-in function output parameters to a swizzled arg 2020-03-01 cepheus Copyright update, mostly to trigger bots again. 2020-03-01 cepheus Fix #2095: correct the indentation. 2020-02-28 cepheus Fix #1461: set the SPIRV-Tools' optimizer's target environment. 2020-02-28 cepheus Fix #2091, remove incorrect assert for division by 0.0. 2020-02-28 wangli28 Add vcpkg installation instructions 2020-02-28 sk Fix for #2075: removed DefaultTBuiltInResource from glslang_c_interface.cpp 2020-02-22 rex.xu Fix an issue of SPV generation for imageAtomicStore. Roll third_party/googletest/ 23b2a3b1c..e588eb1ff (3 commits) google/googletest@23b2a3b...e588eb1 $ git log 23b2a3b1c..e588eb1ff --date=short --no-merges --format='%ad %ae %s' 2020-02-27 absl-team Googletest export 2020-02-25 absl-team Googletest export 2020-02-19 absl-team Googletest export Roll third_party/shaderc/ 738f1655a..6e9087162 (3 commits) google/shaderc@738f165...6e90871 $ git log 738f1655a..6e9087162 --date=short --no-merges --format='%ad %ae %s' 2020-03-03 dneto Get spirv.hpp from SPIRV-Headers, not Glslang (#992) 2020-03-02 rharrison Rolling 6 dependencies and updating expectations (#990) 2020-02-21 rharrison Rolling 6 dependencies and update expectations (#987) Roll third_party/spirv-headers/ 5dbc1c321..0a7fc4525 (1 commit) KhronosGroup/SPIRV-Headers@5dbc1c3...0a7fc45 $ git log 5dbc1c321..0a7fc4525 --date=short --no-merges --format='%ad %ae %s' 2020-02-26 dneto Add grammars, C header, and header generator for vendor and KHR extended instruction sets (#143) Roll third_party/spirv-tools/ 79f8caf91..e1688b60c (10 commits) KhronosGroup/SPIRV-Tools@79f8caf...e1688b6 $ git log 79f8caf91..e1688b60c --date=short --no-merges --format='%ad %ae %s' 2020-02-28 dneto Avoid use of Python distutils.dir_util (#3203) 2020-02-28 rharrison Adding WebGPU specific Workgroup scope rule (#3204) 2020-02-25 jaebaek Add validation rules for OpenCL.DebugInfo.100 extension (#3133) 2020-02-25 geofflang Combine extinst-name and extinst-output-base into one arg. (#3200) 2020-02-23 nicolasweber Fix Wrange-loop-analysis warnings in SPIRV-Tools. (#3201) 2020-02-21 geofflang Add missing dependencies when generating spvtools_core_tables (#3199) 2020-02-21 afdx Brief guide to writing a spirv-fuzz fuzzer pass (#3190) 2020-02-21 47594367+rg3igalia Fix ignored const qualifier warning in static_cast (#3197) 2020-02-20 stevenperron Make spvOpcodeString part of the public API (#3174) 2020-02-20 danyspin97 Fix static libraries linking order (#3189) Roll third_party/swiftshader/ 74d3f371f..126720bd2 (28 commits) https://swiftshader.googlesource.com/SwiftShader.git/+log/74d3f371f201..126720bd2e57 $ git log 74d3f371f..126720bd2 --date=short --no-merges --format='%ad %ae %s' 2020-03-03 jrprice Use LINK_FLAGS for -BSymbolic in CMake build 2020-03-03 capn Fix ASTC support for GN build 2020-03-02 swiftshader.regress Regres: Update test lists @ 416d3745 2020-03-01 capn Enable ASTC on supported builds only 2020-02-27 jmadill PipelineCache: Handle nullptr mismatch of specialization info. 2020-02-24 sugoi Implement ASTC support 2020-02-27 jonahr Add missing attribute to eglGetConfigAttrib 2020-02-27 jmadill Add codereview.settings. 2020-02-26 amaiorano Subzero: add support for variadic calls (System V) 2020-02-26 jmadill Fix comparison of specialization constant keys. 2020-02-25 amaiorano Subzero: add support for large stacks on Windows 2020-02-25 capn Build with -Bsymbolic to prevent symbol preemption 2020-02-25 capn Fix ANGLE standalone build 2020-02-25 capn Fix Android build after SPIRV-Tools update 2020-02-19 srisser Log instead of warn of unsupported extensions 2020-02-25 swiftshader.regress Regres: Update test lists @ e162b023 2020-02-24 capn Add SPIRV-Tools headers dependency 2020-02-24 capn Add SPIR-Tools include headers path for src/Pipeline 2020-02-24 bclayton Squashed 'third_party/SPIRV-Tools/' changes from 8aa423930..8910ea5f1 2020-02-22 thakis Fix Wrange-loop-analysis warnings in swiftshader. 2020-02-21 amaiorano Replace target_cpu with current_cpu in Build.gn files 2020-02-21 sugoi Revert "Subzero: add support for large stacks on Windows" 2020-02-19 amaiorano Subzero: add support for large stacks on Windows 2020-02-20 sugoi VK_EXT_shader_stencil_export support 2020-02-19 bclayton Remove rr::Thread 2020-02-20 capn Support JIT on a separate thread 2020-02-20 sugoi Revert "VK_EXT_shader_stencil_export support" 2020-02-13 sugoi VK_EXT_shader_stencil_export support Roll third_party/vulkan-loader/ c357af84c..136207a63 (3 commits) KhronosGroup/Vulkan-Loader@c357af8...136207a $ git log c357af84c..136207a63 --date=short --no-merges --format='%ad %ae %s' 2020-02-20 mark loader: Remove standard_val refs from LoaderLayerIF doc 2020-02-18 dj2 Move BUILD_TESTS option up as well 2020-02-18 dj2 Allow Vulkan-Headers to be in externals. Roll third_party/vulkan-validationlayers/ 6112b121e..1f337d1a2 (26 commits) KhronosGroup/Vulkan-ValidationLayers@6112b12...1f337d1 $ git log 6112b121e..1f337d1a2 --date=short --no-merges --format='%ad %ae %s' 2020-03-02 jasuarez build: Export build commands 2020-02-28 s.fricke tests: Add tests for checking sType-unique 2020-02-28 s.fricke layers: Add support for sType-unique and most pNext-pNext 2020-02-28 s.fricke tests: Add tests for 02280 and 02281 2020-02-28 s.fricke layers: Add support for 02280 and 02281 2020-02-28 s.fricke tests: Add test for 01545 2020-02-28 s.fricke layers: Add support for 01545 2020-02-29 s.fricke layers: Rename ValidateComputePipelineShaderState 2020-02-29 s.fricke layers: Label VUID 00337, 00338, 00339 2020-02-27 attilio.provenzano tests: Add BP tests for images and buffers 2020-02-27 attilio.provenzano practices: Add checks for images and buffers 2020-02-27 mark gpu: Remove unneeded refs to debug report enums 2020-02-28 igor.ostrowski layers: Fix layer settings file loading using registry 2020-02-27 mark threading: Remove use of debug report defs 2020-02-27 attilio.provenzano tests: Add BP tests for small allocations 2020-02-27 attilio.provenzano practices: Add checks for memory allocations 2020-02-27 attilio.provenzano tests: Add BP tests for command buffers 2020-02-27 attilio.provenzano practices: Add checks for command buffers 2020-02-26 mikes scripts: Add line diff to generate_source.py 2020-02-25 mark tests: Use VkDisplayKHR objects in thread safety validation 2020-02-25 mark threading: Cover createobject calls for display objects 2020-02-20 mark stateless: Remove redundant API version check 2020-02-20 mark corechecks: Remove redundant API version checks 2020-02-19 mark tests: Added BP tests for deprecated extension warnings 2020-02-19 mark practices: Updated deprecrated extension list 2020-01-21 camden layers: Add deprecated extension warnings to BP Created with: roll-dep third_party/clspv third_party/clspv-llvm third_party/cppdap third_party/dxc third_party/glslang third_party/googletest third_party/json third_party/lodepng third_party/shaderc third_party/spirv-headers third_party/spirv-tools third_party/swiftshader third_party/vulkan-headers third_party/vulkan-loader third_party/vulkan-validationlayers
This Cl adds DXC to the Amber third_party directory and enables using
HLSL as a shader language in AmberScript.
Fixes #34