Enable lit by default. (#5133)
* Enable lit by default. * Update README for git user bin. * Add DXC_DISABLE_LIT to replace DXC_ENABLE_LIT * Set -DDXC_DISABLE_LIT=Off for appveyor. * Keep original name for ClangSPIRVTests * Set correct path for unit tests binary. * Remove doc about DXC_DISABLE_LIT * Remove extra space. * Remove DxcOnUnix.rst.
This commit is contained in:
Родитель
58d305353f
Коммит
06a7197e23
|
@ -34,7 +34,7 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: sudo apt install -y ninja-build
|
||||
- name: Configure
|
||||
run: cmake -B build -G Ninja -DLLVM_PARALLEL_LINK_JOBS=1 -DLLVM_USE_LINKER=lld -DCMAKE_BUILD_TYPE=Release -DDXC_USE_LIT=On -DDXC_COVERAGE=On -C ${{github.workspace}}/cmake/caches/PredefinedParams.cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ${{github.workspace}}
|
||||
run: cmake -B build -G Ninja -DLLVM_PARALLEL_LINK_JOBS=1 -DLLVM_USE_LINKER=lld -DCMAKE_BUILD_TYPE=Release -DDXC_COVERAGE=On -C ${{github.workspace}}/cmake/caches/PredefinedParams.cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ${{github.workspace}}
|
||||
- name: Build
|
||||
run: ninja -C build test-depends
|
||||
- name: Test
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"configurationType": "RelWithDebInfo",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "-DDXC_USE_LIT=On -C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
|
||||
"cmakeCommandArgs": "-C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ]
|
||||
|
@ -17,7 +17,7 @@
|
|||
"configurationType": "Debug",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "-DDXC_USE_LIT=On -C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
|
||||
"cmakeCommandArgs": "-C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ]
|
||||
|
@ -28,7 +28,7 @@
|
|||
"configurationType": "RelWithDebInfo",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "-DDXC_USE_LIT=On -C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
|
||||
"cmakeCommandArgs": "-C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "msvc_x86_x64" ]
|
||||
|
@ -39,7 +39,7 @@
|
|||
"configurationType": "Debug",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "-DDXC_USE_LIT=On -C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
|
||||
"cmakeCommandArgs": "-C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "msvc_x86_x64" ]
|
||||
|
|
|
@ -62,11 +62,10 @@ Building on windows additionally requires:
|
|||
|
||||
> A new experimental simplified build and test workflow is documented [here](docs/BuildingAndTestingDXC.rst).
|
||||
|
||||
Note: If you intend to build from sources on Linux/macOS, follow [these instructions](docs/DxcOnUnix.rst).
|
||||
|
||||
Before you build, you will need to have some additional software installed. This is the most straightforward path - see [Building Sources](https://github.com/microsoft/DirectXShaderCompiler/wiki/Building-Sources) on the Wiki for more options, including Visual Studio 2015 and Ninja support.
|
||||
|
||||
* [Git](http://git-scm.com/downloads).
|
||||
* [Git](http://git-scm.com/downloads) - On Windows the Git command line tools must be added to the PATH in order to successfully build and test DXC.
|
||||
* [Python](https://www.python.org/downloads/) - version 3.x is required
|
||||
* [Visual Studio 2019](https://www.visualstudio.com/downloads) - select the following workloads:
|
||||
* Universal Windows Platform Development
|
||||
|
|
|
@ -38,20 +38,20 @@ before_build:
|
|||
- cmd: call utils\hct\hctstart %HLSL_SRC_DIR% %HLSL_BLD_DIR%
|
||||
|
||||
build_script:
|
||||
- cmd: call utils\hct\hctbuild -%PLATFORM% -%CONFIGURATION% -show-cmake-log -spirvtest -disable-lit
|
||||
- cmd: call utils\hct\hctbuild -%PLATFORM% -%CONFIGURATION% -show-cmake-log -spirvtest -enable-lit
|
||||
- sh: mkdir build && cd build
|
||||
- sh: cmake .. -GNinja -C ../cmake/caches/PredefinedParams.cmake -DSPIRV_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_COMPILER=clang++-14 -DLLVM_ENABLE_WERROR=On
|
||||
- sh: ninja
|
||||
|
||||
test_script:
|
||||
- ps: utils\appveyor\appveyor_test.ps1
|
||||
- cmd: call utils\hct\hcttest -rel spirv_only -disable-lit
|
||||
- cmd: call utils\hct\hcttest -rel clang -enable-lit
|
||||
- sh: ./bin/dxc --help
|
||||
- sh: ./bin/dxc -T ps_6_0 ../tools/clang/test/CodeGenSPIRV/passthru-ps.hlsl2spv
|
||||
- sh: ./bin/dxc -T ps_6_0 -Fo passthru-ps.dxil ../tools/clang/test/CodeGenSPIRV/passthru-ps.hlsl2spv
|
||||
- sh: ./bin/dxc -T ps_6_0 -Fo passthru-ps.spv ../tools/clang/test/CodeGenSPIRV/passthru-ps.hlsl2spv -spirv
|
||||
- sh: ./bin/clang-spirv-tests --spirv-test-root ../tools/clang/test/CodeGenSPIRV/
|
||||
- sh: ./bin/ClangHLSLTests --HlslDataDir $PWD/../tools/clang/test/HLSL/
|
||||
- sh: ./tools/clang/unittests/SPIRV/ClangSPIRVTests --spirv-test-root ../tools/clang/test/CodeGenSPIRV/
|
||||
- sh: ./tools/clang/unittests/HLSL/ClangHLSLTests --HlslDataDir $PWD/../tools/clang/test/HLSL/
|
||||
|
||||
after_test:
|
||||
# Collect artifacts for Windows
|
||||
|
|
|
@ -108,7 +108,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 -DDXC_USE_LIT=On -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=--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
|
||||
|
|
|
@ -12,10 +12,11 @@ if (DXC_COVERAGE)
|
|||
set(LLVM_CODE_COVERAGE_TEST_TARGETS "check-all" CACHE STRING "")
|
||||
endif()
|
||||
|
||||
if (DXC_USE_LIT)
|
||||
set(LLVM_TEST_VALUE ON)
|
||||
else()
|
||||
# TODO: remove this option after switch to support lit only.
|
||||
if (DXC_DISABLE_LIT)
|
||||
set(LLVM_TEST_VALUE OFF)
|
||||
else()
|
||||
set(LLVM_TEST_VALUE ON)
|
||||
endif()
|
||||
|
||||
set(LLVM_INCLUDE_TESTS ${LLVM_TEST_VALUE} CACHE BOOL "")
|
||||
|
|
|
@ -12,8 +12,6 @@ Building and Testing DirectXShaderCompiler
|
|||
is complete on Linux and Unix platforms, but is incomplete but usable on
|
||||
Windows. Instructions for building on Windows are available in the repository
|
||||
`readme <https://github.com/microsoft/DirectXShaderCompiler/blob/main/README.md>`_.
|
||||
Instructions for the preexisting Linux and Unix workflow can be found here:
|
||||
:doc:`DxcOnUnix`
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
@ -57,7 +55,6 @@ Open a Visual Stuido command prompt and run:
|
|||
.. code:: sh
|
||||
cmake <Repository Root> \
|
||||
-B <Path to Output> \
|
||||
-DDXC_USE_LIT=On \
|
||||
-C <Repository Root>/cmake/caches/PredefinedParams.cmake \
|
||||
-DCMAKE_BUILD_TYPE=<Build Type> \
|
||||
-G "Visual Studio 17 2022"
|
||||
|
@ -85,7 +82,6 @@ In your preferred terminal run:
|
|||
.. code:: sh
|
||||
cmake <Repository Root> \
|
||||
-B <Path to Output> \
|
||||
-DDXC_USE_LIT=On \
|
||||
-C <Repository Root>/cmake/caches/PredefinedParams.cmake \
|
||||
-DCMAKE_BUILD_TYPE=<Build Type> \
|
||||
-G Ninja
|
||||
|
@ -150,10 +146,3 @@ four commonly used option prefixes:
|
|||
code coverage reports. With this setting enabled the
|
||||
``generate-coverage-report`` target is added to the build which produces a
|
||||
static HTML page with code coverage analysis results.
|
||||
|
||||
**DXC_USE_LIT**:BOOL
|
||||
This option must be passed before the ``-C`` flag to set the PredefinedParams
|
||||
cache script because it is handled by the cache script. This option enables
|
||||
building DXC with the LLVM-LIT testing infrastructure enabled. This generates
|
||||
check targets for each sub-project (i.e. ``check-llvm``, ``check-clang``...),
|
||||
and a ``check-all`` target to build and run DXC's tests.
|
||||
|
|
|
@ -1,141 +0,0 @@
|
|||
======================================
|
||||
DirectXShaderCompiler on Linux & macOS
|
||||
======================================
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
:depth: 3
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
DirectXShaderCompiler (DXC) is based on LLVM/Clang, which is originally
|
||||
cross-platform. However, to support HLSL, certain Windows specific techniques
|
||||
(like COM, SAL, etc.) are introduced to solve technical issues on the Windows
|
||||
platform, which also makes DXC not compilable/runnable on non-Windows platforms.
|
||||
|
||||
Upon `several <https://github.com/Microsoft/DirectXShaderCompiler/issues/1082>`_
|
||||
`requests <https://github.com/Microsoft/DirectXShaderCompiler/issues/1236>`_
|
||||
from the community, we have started the effort to enable compilation and running
|
||||
of DXC on non-Windows platforms (Linux and macOS).
|
||||
|
||||
Current Status
|
||||
==============
|
||||
|
||||
Up and Running
|
||||
--------------
|
||||
We have currently reached the point where we can successfully build and run DXC
|
||||
on Linux and macOS. Code generation works for both DXIL and SPIR-V, and we are
|
||||
also able to run the whole SPIR-V and a large portion of DXIL CodeGen test suite
|
||||
on these platforms.
|
||||
|
||||
*Note: This work is currently in experimental phase. How we implement certain
|
||||
things for Unix platforms may change without considering backward portability.*
|
||||
|
||||
Known Limitations
|
||||
-----------------
|
||||
|
||||
The following targets are currently disabled for non-Windows platforms and this
|
||||
is an area where further contributions can be made:
|
||||
|
||||
* d3dcomp
|
||||
* dxlib-sample
|
||||
|
||||
Moreover, since the HLSL CodeGen tests were originally written with Windows in
|
||||
mind, they require the Windows-specific `TAEF Framework <https://docs.microsoft.com/en-us/windows-hardware/drivers/taef/>`_
|
||||
to run. Besides, some tests also require DirectX to execute. Therefore we are
|
||||
not able to compile/run all these tests on non-Windows platforms. Note that
|
||||
it is only the testing infrastructure that has this limitation, and DXIL CodeGen
|
||||
works as expected by running the DXC executable.
|
||||
|
||||
Known Issues
|
||||
------------
|
||||
- Running the SPIR-V CodeGen tests results in opening a large number of file
|
||||
descriptors, and if the OS limitation on the number of FDs allowed to be opened
|
||||
by a process is low, it will cause test failures. We have not seen this as an
|
||||
issue on Windows and Linux. On macOS we currently increase the allowed limit to
|
||||
get around the problem for the time being.
|
||||
|
||||
- The version number of the shared library is currently stuck at 3.7. We need to
|
||||
fix this once a certain versioning scheme is in place.
|
||||
|
||||
Building and Using
|
||||
==================
|
||||
|
||||
Build Requirements
|
||||
------------------
|
||||
Please make sure you have the following resources before building:
|
||||
|
||||
- `Git <https://git-scm.com/downloads>`_
|
||||
- `Python <https://www.python.org/downloads/>`_. Version 3.x is required.
|
||||
- `Ninja <https://github.com/ninja-build/ninja/releases>`_ (*Optional* CMake generator)
|
||||
- Either of gcc/g++ or clang/clang++ compilers. Minimum supported version:
|
||||
|
||||
- `GCC <https://gcc.gnu.org/releases.html>`_ version 5.5 or higher.
|
||||
- `Clang <http://releases.llvm.org/>`_ version 3.8 or higher.
|
||||
|
||||
|
||||
Building DXC
|
||||
------------
|
||||
You can follow these steps to build DXC on Linux/macOS:
|
||||
|
||||
.. code:: sh
|
||||
|
||||
cd <dxc-build-dir>
|
||||
cmake <dxc-src-dir> -GNinja -DCMAKE_BUILD_TYPE=Release -C <dxc-src-dir>/cmake/caches/PredefinedParams.cmake
|
||||
ninja
|
||||
|
||||
Note that ``PredefinedParams.cmake`` is a cache script, which will execute
|
||||
before the main ``CMakeLists.txt`` file and initialize several cmake options
|
||||
that are needed for successful configuration and compilation. You can further
|
||||
customize your build by adding configurations at the end of the cmake command
|
||||
above.
|
||||
|
||||
For instance, you can use
|
||||
|
||||
``-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++``
|
||||
|
||||
or
|
||||
|
||||
``-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++``
|
||||
|
||||
to choose your desired C/C++ compiler.
|
||||
|
||||
You should now have the dxc executable located at ``<dxc-build-dir>/bin/dxc``.
|
||||
And you should be able to successfully run commands as you would on Windows, e.g:
|
||||
|
||||
.. code:: sh
|
||||
|
||||
./bin/dxc -help
|
||||
./bin/dxc -T <target> -E <entry-point-name> <input-hlsl-file>
|
||||
|
||||
Note that you cannot use slashes (``/``) for specifying command line options as
|
||||
you would on Windows. You should use dashes as per usual Unix style.
|
||||
|
||||
Building and Running Tests
|
||||
--------------------------
|
||||
|
||||
The tests are run using the GoogleTest framework.
|
||||
|
||||
You can follow these steps to build and run the tests:
|
||||
|
||||
.. code:: sh
|
||||
|
||||
cd <dxc-build-dir>
|
||||
# Use SPIRV_BUILD_TESTS flag to enable building these tests.
|
||||
cmake <dxc-src-dir> \
|
||||
-C <dxc-src-dir>/cmake/caches/PredefinedParams.cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release -DSPIRV_BUILD_TESTS=ON \
|
||||
-GNinja
|
||||
# Build all targets. Includes 'dxc' and tests.
|
||||
ninja
|
||||
# Run all tests
|
||||
ctest
|
||||
|
||||
|
||||
As described in the `Known Issues`_ section above, you currently need to
|
||||
increase the maximum per-process open files on macOS using
|
||||
``ulimit -Sn 1024`` before running the tests on that platform.
|
||||
|
||||
TODO: Add more information about Linux implementation details.
|
||||
|
|
@ -16,7 +16,6 @@ steps:
|
|||
- '-DCMAKE_CXX_COMPILER=clang++'
|
||||
- '-DCMAKE_C_COMPILER=clang'
|
||||
- '-DCMAKE_INSTALL_PREFIX=artifacts'
|
||||
- '-DDXC_USE_LIT=ON'
|
||||
- '-DENABLE_SPIRV_CODEGEN=ON'
|
||||
- '-DSPIRV_BUILD_TESTS=ON'
|
||||
- '-DLLVM_ENABLE_WERROR=On'
|
||||
|
|
|
@ -42,7 +42,6 @@ target_include_directories(ClangSPIRVTests
|
|||
PRIVATE ${SPIRV_TOOLS_INCLUDE_DIR} ${DXC_EFFCEE_DIR})
|
||||
|
||||
if (NOT CLANG_INCLUDE_TESTS)
|
||||
set_target_properties(ClangSPIRVTests PROPERTIES OUTPUT_NAME clang-spirv-tests)
|
||||
set_output_directory(ClangSPIRVTests
|
||||
${LLVM_RUNTIME_OUTPUT_INTDIR} ${LLVM_LIBRARY_OUTPUT_INTDIR})
|
||||
endif()
|
||||
|
|
|
@ -42,7 +42,7 @@ set SPV_TEST=OFF
|
|||
set DXILCONV=ON
|
||||
set DXC_CMAKE_SYSTEM_VERSION=
|
||||
set SHOW_CMAKE_LOG=0
|
||||
set ENABLE_LIT=OFF
|
||||
set ENABLE_LIT=ON
|
||||
set WINSDK_MIN_VERSION=10.0.17763.0
|
||||
set INSTALL_DIR=
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ set TEST_DXILCONV_FILTER=
|
|||
set TEST_EXEC_FUTURE=0
|
||||
set TEST_EXTRAS=0
|
||||
set TEST_EXEC_REQUIRED=0
|
||||
set TEST_USE_LIT=0
|
||||
set TEST_USE_LIT=1
|
||||
set TEST_CLANG_FILTER=
|
||||
set TEST_EXEC_FILTER=ExecutionTest::*
|
||||
set LOG_FILTER=/logOutput:LowWithConsoleBuffering
|
||||
|
@ -332,12 +332,12 @@ if not "%DXIL_DLL_LOC%"=="" (
|
|||
|
||||
rem Begin SPIRV change
|
||||
if "%TEST_SPIRV%"=="1" (
|
||||
if not exist %BIN_DIR%\clang-spirv-tests.exe (
|
||||
echo clang-spirv-tests.exe has not been built. Make sure you run "hctbuild -spirvtest" first.
|
||||
if not exist %BIN_DIR%\ClangSPIRVTests.exe (
|
||||
echo ClangSPIRVTests.exe has not been built. Make sure you run "hctbuild -spirvtest" first.
|
||||
exit /b 1
|
||||
)
|
||||
echo Running SPIRV tests ...
|
||||
%BIN_DIR%\clang-spirv-tests.exe --spirv-test-root %HLSL_SRC_DIR%\tools\clang\test\CodeGenSPIRV
|
||||
%BIN_DIR%\ClangSPIRVTests.exe --spirv-test-root %HLSL_SRC_DIR%\tools\clang\test\CodeGenSPIRV
|
||||
if errorlevel 1 (
|
||||
echo Failure occured in SPIRV unit tests
|
||||
exit /b 1
|
||||
|
|
Загрузка…
Ссылка в новой задаче