From 5bb72988273e04c06240a91585b2d7db0ec89776 Mon Sep 17 00:00:00 2001 From: kazhang Date: Mon, 12 Feb 2024 12:25:30 -0800 Subject: [PATCH] Use gcc-10 in linux workflow Link with -ldl on linux --- .github/workflows/linux-x86_64.yml | 13 ++++++++++++- .github/workflows/release-linux.yml | 13 ++++++++++++- .github/workflows/release-windows.yml | 3 ++- .github/workflows/win64.yml | 2 +- dependencies.xml | 4 ++-- source/CMakeLists.txt | 18 ++++++++---------- source/DeviceWrapper.cpp | 12 +++--------- source/main.cpp | 5 +++-- source/simplest.cpp | 16 ++++++++++++++++ 9 files changed, 59 insertions(+), 27 deletions(-) create mode 100644 source/simplest.cpp diff --git a/.github/workflows/linux-x86_64.yml b/.github/workflows/linux-x86_64.yml index a053c5f..a110558 100644 --- a/.github/workflows/linux-x86_64.yml +++ b/.github/workflows/linux-x86_64.yml @@ -9,9 +9,20 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: + - name: select gcc 10 + run: | + sudo update-alternatives \ + --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-10 \ + --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-10 \ + --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-10 \ + --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-10 \ + --slave /usr/bin/gcov gcov /usr/bin/gcov-10 \ + --slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-10 \ + --slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-10 - uses: actions/checkout@v3 - name: Install prerequisite run: sudo apt-get install ninja-build diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 96a94fe..a94db46 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -9,9 +9,20 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: + - name: select gcc 10 + run: | + sudo update-alternatives \ + --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-10 \ + --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-10 \ + --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-10 \ + --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-10 \ + --slave /usr/bin/gcov gcov /usr/bin/gcov-10 \ + --slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-10 \ + --slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-10 - uses: actions/checkout@v3 - name: Install prerequisite run: sudo apt-get install ninja-build diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml index 373a6f5..5bd1c72 100644 --- a/.github/workflows/release-windows.yml +++ b/.github/workflows/release-windows.yml @@ -26,7 +26,7 @@ jobs: id: build run: | echo "build app" - cmake --build build/windows-ninja-msvc --config Release + cmake --build build/windows-ninja-msvc --config Release --verbose $tagName = & git describe --tags $binArchive = "falcor_perf_test-$tagName-win-64.zip" echo "package name=$binArchive" @@ -34,6 +34,7 @@ jobs: cd build/windows-ninja-msvc 7z a "$binArchive" bin/Release/* echo "FALCOR_PERF_TEST_PACKAGE=build/windows-ninja-msvc/$binArchive" >> $env:GITHUB_OUTPUT + - name: UploadBinary uses: softprops/action-gh-release@v1 with: diff --git a/.github/workflows/win64.yml b/.github/workflows/win64.yml index 2a963bb..4040a76 100644 --- a/.github/workflows/win64.yml +++ b/.github/workflows/win64.yml @@ -23,4 +23,4 @@ jobs: - name: configure run: cmake --preset windows-ninja-msvc - name: make - run: cmake --build build/windows-ninja-msvc + run: cmake --build build/windows-ninja-msvc --verbose diff --git a/dependencies.xml b/dependencies.xml index 1f64454..e5fdf44 100644 --- a/dependencies.xml +++ b/dependencies.xml @@ -2,8 +2,8 @@ - - + + diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index b8de763..55090c9 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -1,14 +1,7 @@ add_executable(falcor_perftest) target_sources(falcor_perftest PRIVATE - main.cpp - Object.cpp - path-tracer.cpp - Program.cpp - ProgramManager.cpp - ProgramReflection.cpp - ProgramVersion.cpp - DeviceWrapper.cpp + simplest.cpp ) target_copy_shaders(falcor_perftest ./shaders .) @@ -115,8 +108,13 @@ target_compile_definitions(falcor_perftest target_link_libraries(falcor_perftest PUBLIC - slang slang-gfx - external_includes + slang + # slang-gfx + # external_includes + # $<$:dl> + $<$:-static-libgcc> + $<$:-static-libstdc++> + $<$:-l:libwinpthread.a> ) set_target_properties(falcor_perftest PROPERTIES diff --git a/source/DeviceWrapper.cpp b/source/DeviceWrapper.cpp index c16bcae..6105606 100644 --- a/source/DeviceWrapper.cpp +++ b/source/DeviceWrapper.cpp @@ -3,6 +3,7 @@ Device::Device() { + printf("slang: create global session\n"); slang::createGlobalSession(m_slangGlobalSession.writeRef()); m_pProgramManager = std::make_unique(this); @@ -12,15 +13,7 @@ Device::Device() gfxDesc.shaderCache.maxEntryCount = 1000; gfxDesc.shaderCache.shaderCachePath = nullptr; - std::vector extendedDescs; - // Add extended desc for root parameter attribute. - gfx::D3D12DeviceExtendedDesc extDesc = {}; - extDesc.rootParameterShaderAttributeName = "root"; - extendedDescs.push_back(&extDesc); - - gfxDesc.extendedDescCount = extendedDescs.size(); - gfxDesc.extendedDescs = extendedDescs.data(); - + printf("gfx:: get GPU adapters\n"); gfx::AdapterList adapters = gfx::gfxGetAdapters(gfxDesc.deviceType); if (adapters.getCount() == 0) { @@ -33,6 +26,7 @@ Device::Device() mpAPIDispatcher.reset(new PipelineCreationAPIDispatcher()); gfxDesc.apiCommandDispatcher = static_cast(mpAPIDispatcher.get()); + printf("gfx create device\n"); if (SLANG_FAILED(gfx::gfxCreateDevice(&gfxDesc, m_gfxDevice.writeRef()))) { printf("Failed to create device on GPU 0 (%s).", adapters.getAdapters()[0].name); diff --git a/source/main.cpp b/source/main.cpp index 37eb3cf..71c3293 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -128,8 +128,9 @@ void TestCase(ref& device) int main(int argc, char* argv[]) { - ref device = make_ref(); - TestCase(device); + printf("Starting creating device\n"); + // ref device = make_ref(); + // TestCase(device); return 0; } diff --git a/source/simplest.cpp b/source/simplest.cpp new file mode 100644 index 0000000..92ae556 --- /dev/null +++ b/source/simplest.cpp @@ -0,0 +1,16 @@ +#include +#include +#include + +int main(int argc, char* argv[]) +{ + printf("Starting creating device\n"); + SlangSession* globalSession = spCreateSession(); + printf("C API: slang session: %p\n", globalSession); + + + Slang::ComPtr slangGlobalSession; + slang::createGlobalSession(slangGlobalSession.writeRef()); + printf("C++ API: slang session: %p\n", slangGlobalSession.get()); + return 0; +}