Skip to content

Commit

Permalink
[PTI-LIB] Add g++ compiler to Nightly Build
Browse files Browse the repository at this point in the history
Add g++ compiler to nightly build to catch extra warnings or errors not
found by clang or icpx.

This configuration includes the optimization level to avoid occasional build
errors with `FORTIFY_SOURCE`, it issues a warning if optimizations are
turned on.

Add warning for extra semi-colons.

Remove cast in test now that we have a function capable of printing.

Signed-off-by: Schilling, Matthew <matthew.schilling@intel.com>
  • Loading branch information
mschilling0 authored Dec 19, 2024
1 parent db99d6d commit 1dd699b
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/nightly_build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ jobs:
- container: ${{ vars.PTI_DOCKER_ROCKY_8_ONEAPI_25_0_0 }}
uploadname: "rocky-8.2025.0.0"
preset: linux-icpx-release

- container: ${{ vars.PTI_DOCKER_ROCKY_8_ONEAPI_25_0_0 }}
uploadname: "rocky-8.gxx.2025.0.0"
preset: linux-gxx-release

container:
image: ${{ matrix.container }}
Expand Down
41 changes: 35 additions & 6 deletions sdk/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/toolchains/icpx_toolchain.cmake",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wformat -Werror -Wformat-security -Werror=format-security -fstack-protector-strong -D_FORTIFY_SOURCE=2",
"CMAKE_C_FLAGS": "-Wall -Wextra -Wformat -Werror -Wformat-security -Werror=format-security -fstack-protector-strong -D_FORTIFY_SOURCE=2",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wextra-semi -Wformat -Werror -Wformat-security -Werror=format-security -fstack-protector-strong -D_FORTIFY_SOURCE=2",
"CMAKE_C_FLAGS": "-Wall -Wextra -Wextra-semi -Wformat -Werror -Wformat-security -Werror=format-security -fstack-protector-strong -D_FORTIFY_SOURCE=2",
"CMAKE_SHARED_LINKER_FLAGS": "-Wl,-z,relro,-z,now,-z,noexecstack",
"CMAKE_EXE_LINKER_FLAGS": "-Wl,-z,relro,-z,now,-z,noexecstack"
}
Expand All @@ -25,8 +25,8 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/toolchains/icpx_toolchain.cmake",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wformat -Werror -Wformat-security -Werror=format-security -g -fstack-protector-strong -D_FORTIFY_SOURCE=2",
"CMAKE_C_FLAGS": "-Wall -Wextra -Wformat -Werror -Wformat-security -Werror=format-security -g -fstack-protector-strong -D_FORTIFY_SOURCE=2",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wextra-semi -Wformat -Werror -Wformat-security -Werror=format-security -g -fstack-protector-strong -D_FORTIFY_SOURCE=2",
"CMAKE_C_FLAGS": "-Wall -Wextra -Wextra-semi -Wformat -Werror -Wformat-security -Werror=format-security -g -fstack-protector-strong -D_FORTIFY_SOURCE=2",
"CMAKE_SHARED_LINKER_FLAGS": "-Wl,-z,relro,-z,now,-z,noexecstack",
"CMAKE_EXE_LINKER_FLAGS": "-Wl,-z,relro,-z,now,-z,noexecstack"
}
Expand All @@ -41,8 +41,8 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/toolchains/icpx_toolchain.cmake",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wformat -Wformat-security -fno-omit-frame-pointer -fno-optimize-sibling-calls",
"CMAKE_C_FLAGS": "-Wall -Wextra -Wformat -Wformat-security -fno-omit-frame-pointer -fno-optimize-sibling-calls",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wextra-semi -Wformat -Wformat-security -fno-omit-frame-pointer -fno-optimize-sibling-calls",
"CMAKE_C_FLAGS": "-Wall -Wextra -Wextra-semi -Wformat -Wformat-security -fno-omit-frame-pointer -fno-optimize-sibling-calls",
"PTI_ENABLE_LOGGING": "ON"
}
},
Expand Down Expand Up @@ -135,6 +135,22 @@
"PTI_ENABLE_LOGGING": "ON"
}
},
{
"name": "linux-gxx-release",
"displayName": "Linux Release x64 GCC Ninja Config",
"description": "Linux Release x64 Config using Ninja generator and gcc/g++ compiler",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wextra-semi -Wformat -Werror -Wformat-security -Werror=format-security -fstack-protector-strong -O3 -D_FORTIFY_SOURCE=2",
"CMAKE_C_FLAGS": "-Wall -Wextra -Wextra-semi -Wformat -Werror -Wformat-security -Werror=format-security -fstack-protector-strong -O3 -D_FORTIFY_SOURCE=2",
"CMAKE_SHARED_LINKER_FLAGS": "-Wl,-z,relro,-z,now,-z,noexecstack",
"CMAKE_EXE_LINKER_FLAGS": "-Wl,-z,relro,-z,now,-z,noexecstack"
}
},
{
"name": "windows-icx-debug",
"displayName": "Windows Debug x64 IntelLLVM Config",
Expand Down Expand Up @@ -275,6 +291,11 @@
"configurePreset": "linux-tsan",
"displayName": "Linux ThreadSanitizer Build"
},
{
"name": "linux-gxx-release",
"configurePreset": "linux-gxx-release",
"displayName": "Linux gcc/g++ Build"
},
{
"name": "windows-debug",
"displayName": "Windows Debug x64 MSVC Build",
Expand Down Expand Up @@ -384,6 +405,14 @@
"LD_LIBRARY_PATH": "${sourceDir}/build-${presetName}/lib:$penv{LD_LIBRARY_PATH}"
}
},
{
"name": "linux-gxx-release",
"configurePreset": "linux-gxx-release",
"displayName": "Linux gcc/g++ Tests",
"environment": {
"LD_LIBRARY_PATH": "${sourceDir}/build-${presetName}/lib:$penv{LD_LIBRARY_PATH}"
}
},
{
"name": "windows-icx-debug",
"displayName": "Windows Debug x64 IntelLLVM Test",
Expand Down
6 changes: 3 additions & 3 deletions sdk/samples/iso3dfd_dpcpp/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
bool CheckGridDimension(size_t n1, size_t n2, size_t n3, unsigned int dim_x,
unsigned int dim_y, unsigned int block_z) {

if (0 == dim_x) {
std::cout << " ERROR: Invalid Grid Size: DIMX cannot be Zero\n";
return true;
Expand All @@ -26,7 +26,7 @@ bool CheckGridDimension(size_t n1, size_t n2, size_t n3, unsigned int dim_x,
std::cout << " ERROR: Invalid Grid Size: BLOCKZ cannot be Zero\n";
return true;
}

if (n1 % dim_x) {
std::cout << " ERROR: Invalid Grid Size: n1 should be multiple of DIMX - "
<< dim_x << "\n";
Expand Down Expand Up @@ -119,7 +119,7 @@ void Usage(const std::string& programName) {
void PrintStats(double time, size_t n1, size_t n2, size_t n3,
unsigned int nIterations) {
float throughput_mpoints = 0.0f, mflops = 0.0f, normalized_time = 0.0f;
double mbytes = 0.0f;
double mbytes = 0.0;

std::cout << "--------------------------------------\n";
if (0 < nIterations) {
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/levelzero/ze_local_collection_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class A2EventPool {
A2EventPool(A2EventPool&&) = delete;
A2EventPool& operator=(A2EventPool&&) = delete;
A2EventPool() = delete;
A2EventPool(uint32_t events_per_pool) : events_per_pool_count_(events_per_pool){};
A2EventPool(uint32_t events_per_pool) : events_per_pool_count_(events_per_pool) {}
~A2EventPool() {}

ze_event_handle_t GetEvent(const ze_context_handle_t context) {
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/sycl/sycl_collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ class SyclCollector {

private:
explicit SyclCollector(OnSyclRuntimeViewCallback buffer_callback)
: acallback_(buffer_callback), xptiGetStashedKV(GetStashedFuncPtrFromSharedObject()){};
: acallback_(buffer_callback), xptiGetStashedKV(GetStashedFuncPtrFromSharedObject()) {}

int32_t trace_all_env_value = utils::IsSetEnv("PTI_TRACE_ALL_RUNTIME_OPS");
inline static thread_local ZeKernelCommandExecutionRecord sycl_runtime_rec_;
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/utils/internal_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ bool IsValid(IntType val, EnumVal V) {
static_assert(std::is_enum<EnumVal>::value);
static_assert(std::is_same<EnumType, EnumVal>::value);
return static_cast<IntType>(V) == val;
};
}

template <typename IntType, typename EnumType, typename EnumVal, typename... Next>
bool IsValid(IntType val, EnumVal V, Next... oth) {
static_assert(std::is_enum<EnumVal>::value);
static_assert(std::is_same<EnumType, EnumVal>::value);

return static_cast<IntType>(V) == val || IsValid<IntType, EnumType, Next...>(val, oth...);
};
}

///////////////////////////////////////////////////////////////////////////////
/// @brief Checks is the provided value v belongs to pti_view_kind enums
Expand Down
2 changes: 1 addition & 1 deletion sdk/test/main_dpcgemm_fixture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class MainFixtureTest : public ::testing::TestWithParam<std::tuple<bool, bool, b
last_kernel_timestamp = 0;
user_real_timestamp = 0;
sycl_has_all_records = false;
};
}

void TearDown() override {
// Called right before destructor after each test
Expand Down
2 changes: 1 addition & 1 deletion sdk/test/main_startstop_fixture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ static void BufferCompleted(unsigned char *buf, size_t buf_size, size_t valid_bu
}
}
::operator delete(buf);
};
}

template <typename T>
[[maybe_unused]] void InitVectors(std::vector<T> &a, std::vector<T> &b, std::vector<T> &c,
Expand Down
2 changes: 1 addition & 1 deletion sdk/test/utils/test_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ inline std::vector<unsigned char> CreateEmptyBuffer() {
std::size_t buffer_size = 0;
((buffer_size += (RecordInsert::kNumber * sizeof(typename RecordInsert::Type))), ...);
return std::vector<unsigned char>(buffer_size);
};
}

template <typename... RecordInsert>
inline std::vector<unsigned char> CreateFullBuffer() {
Expand Down
3 changes: 2 additions & 1 deletion sdk/test/view_gpu_local_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <iostream>

#include "pti/pti_view.h"
#include "utils/test_helpers.h"

class ViewGPULocalFixtureTest : public ::testing::Test {
protected:
Expand All @@ -18,7 +19,7 @@ TEST_F(ViewGPULocalFixtureTest, CheckGPULocalViewAvailable) {
EXPECT_TRUE(result == pti_result::PTI_SUCCESS ||
result == pti_result::PTI_ERROR_L0_LOCAL_PROFILING_NOT_SUPPORTED);

std::cout << "result: " << (uint32_t)result << std::endl;
std::cout << "result: " << result << std::endl;

// just exercising two times and verifying the answer is the same
pti_result result2 = ptiViewGPULocalAvailable();
Expand Down

0 comments on commit 1dd699b

Please sign in to comment.