Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
set(NEO_DISABLE_LD_GOLD TRUE)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/sse2neon)
elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
message(WARNING "Maybe Unsupported target processor(64Bit): ${CMAKE_SYSTEM_PROCESSOR}")
set(NEO_TARGET_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
endif()
if(NOT ${NEO_TARGET_PROCESSOR} STREQUAL "x86_64")
set(DISABLE_WDDM_LINUX TRUE)
endif()
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/shared/source/gmm_helper/igfxfmid_wrapper/${BRANCH_DIR_SUFFIX}")
Expand Down Expand Up @@ -146,12 +151,18 @@ endif()

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(NEO_BITS "64")
set(NEO_ARCH "x64")
else()
set(NEO_BITS "32")
set(NEO_ARCH "x86")
endif()

if(${NEO_TARGET_PROCESSOR} STREQUAL "x86_64" AND ${NEO_BITS} STREQUAL "32")
set(NEO_ARCH "x86")
elseif (${NEO_TARGET_PROCESSOR} STREQUAL "x86_64")
set(NEO_ARCH "x64")
else()
set(NEO_ARCH "${NEO_TARGET_PROCESSOR}")
endif ()

if(NOT DEFINED NEO_BUILD_WITH_OCL)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/opencl/CMakeLists.txt)
set(NEO_BUILD_WITH_OCL TRUE)
Expand Down
1 change: 0 additions & 1 deletion level_zero/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ if(BUILD_WITH_L0)
${NEO_SHARED_DIRECTORY}/helpers/abort.cpp
${NEO_SHARED_DIRECTORY}/helpers/debug_helpers.cpp
${NEO_SHARED_DIRECTORY}/helpers/file_io.cpp
${NEO_SHARED_DIRECTORY}/utilities/cpuintrinsics.cpp
${NEO_SHARED_DIRECTORY}/utilities/debug_settings_reader_creator.cpp
${NEO_SHARED_DIRECTORY}/utilities/io_functions.cpp
${NEO_SHARED_DIRECTORY}/built_ins/sip_init.cpp
Expand Down
1 change: 0 additions & 1 deletion opencl/source/dll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ set(RUNTIME_SRCS_DLL_BASE
${NEO_SHARED_DIRECTORY}/helpers/allow_deferred_deleter.cpp
${NEO_SHARED_DIRECTORY}/helpers/debug_helpers.cpp
${NEO_SHARED_DIRECTORY}/helpers/file_io.cpp
${NEO_SHARED_DIRECTORY}/utilities/cpuintrinsics.cpp
${NEO_SHARED_DIRECTORY}/utilities/debug_settings_reader_creator.cpp
${NEO_SHARED_DIRECTORY}/utilities/io_functions.cpp
${NEO_SOURCE_DIR}/opencl/source/api/api.cpp
Expand Down
17 changes: 13 additions & 4 deletions shared/source/helpers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ set(NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.h
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.inl
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_special.inl
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_sse4.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_work_size.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_work_size.h
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_flags.h
Expand Down Expand Up @@ -164,8 +163,6 @@ set(NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/topology.h
${CMAKE_CURRENT_SOURCE_DIR}/topology.cpp
${CMAKE_CURRENT_SOURCE_DIR}/topology_map.h
${CMAKE_CURRENT_SOURCE_DIR}/uint16_avx2.h
${CMAKE_CURRENT_SOURCE_DIR}/uint16_sse4.h
${CMAKE_CURRENT_SOURCE_DIR}/validators.h
${CMAKE_CURRENT_SOURCE_DIR}/vec.h
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}blit_properties_ext.h
Expand All @@ -181,6 +178,14 @@ set(NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/cpu_copy_helper.h
)

if(MSVC OR COMPILER_SUPPORTS_SSE42)
list(APPEND NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_sse4.cpp
${CMAKE_CURRENT_SOURCE_DIR}/uint16_avx2.h
${CMAKE_CURRENT_SOURCE_DIR}/uint16_sse4.h
)
endif()

if(WIN32)
list(APPEND NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/windows/path.cpp
Expand Down Expand Up @@ -278,4 +283,8 @@ endif()

set_property(GLOBAL PROPERTY NEO_CORE_HELPERS ${NEO_CORE_HELPERS})

add_subdirectories()
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${NEO_TARGET_PROCESSOR}")
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/${NEO_TARGET_PROCESSOR}")
else ()
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/general")
endif ()
13 changes: 13 additions & 0 deletions shared/source/helpers/general/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Copyright (C) 2026 Intel Corporation
#
# SPDX-License-Identifier: MIT
#

set(NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stream_copy.cpp
)

set_property(GLOBAL APPEND PROPERTY NEO_CORE_HELPERS ${NEO_CORE_HELPERS})
36 changes: 36 additions & 0 deletions shared/source/helpers/general/local_id_gen.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2018-2026 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

#include "shared/source/helpers/local_id_gen.h"

#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/local_id_gen_special.inl"
#include "shared/source/utilities/cpu_info.h"

#include <array>

namespace NEO {

// Initialize the lookup table based on CPU capabilities
LocalIDHelper::LocalIDHelper() {
}

LocalIDHelper LocalIDHelper::initializer;

// traditional function to generate local IDs
void generateLocalIDs(void *buffer, uint16_t simd, const std::array<uint16_t, 3> &localWorkgroupSize, const std::array<uint8_t, 3> &dimensionsOrder, bool isImageOnlyKernel, uint32_t grfSize, uint32_t grfCount, const RootDeviceEnvironment &rootDeviceEnvironment, uint8_t activeChannels) {
bool useLayoutForImages = isImageOnlyKernel && isCompatibleWithLayoutForImages(localWorkgroupSize, dimensionsOrder, simd);
if (useLayoutForImages) {
generateLocalIDsWithLayoutForImages(buffer, localWorkgroupSize, simd);
} else {
generateLocalIDsForSimdOne(buffer, localWorkgroupSize, dimensionsOrder, grfSize);
}
}

} // namespace NEO
17 changes: 17 additions & 0 deletions shared/source/helpers/general/stream_copy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (C) 2026 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

#include "shared/source/helpers/cpu_copy_helper.h"
#include "shared/source/helpers/string.h"

namespace NEO {

void streamCopy(void *dst, const void *src, size_t bytes) noexcept {
memcpy_s(dst, bytes, src, bytes);
}

} // namespace NEO
8 changes: 6 additions & 2 deletions shared/source/utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,9 @@ set(NEO_CORE_UTILITIES_WINDOWS

set_property(GLOBAL PROPERTY NEO_CORE_UTILITIES ${NEO_CORE_UTILITIES})
set_property(GLOBAL PROPERTY NEO_CORE_UTILITIES_WINDOWS ${NEO_CORE_UTILITIES_WINDOWS})

add_subdirectories()
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${NEO_TARGET_PROCESSOR}")
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/${NEO_TARGET_PROCESSOR}")
else ()
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/general")
endif ()
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/linux")
1 change: 1 addition & 0 deletions shared/source/utilities/aarch64/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ if(${NEO_TARGET_PROCESSOR} STREQUAL "aarch64")
set_property(GLOBAL APPEND PROPERTY NEO_CORE_UTILITIES
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/cpu_info_aarch64.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cpuintrinsics.cpp
)
endif()
65 changes: 65 additions & 0 deletions shared/source/utilities/aarch64/cpuintrinsics.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (C) 2020-2026 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

#include "shared/source/utilities/cpuintrinsics.h"
#include <sse2neon.h>

namespace NEO {
namespace CpuIntrinsics {

void clFlush(void const *ptr) {
_mm_clflush(ptr);
}

void clFlushOpt(void *ptr) {
#ifdef SUPPORTS_CLFLUSHOPT
_mm_clflushopt(ptr);
#else
_mm_clflush(ptr);
#endif
}

void sfence() {
_mm_sfence();
}

void mfence() {
_mm_mfence();
}

void pause() {
_mm_pause();
}

uint8_t tpause(uint32_t control, uint64_t counter) {
#ifdef SUPPORTS_WAITPKG
return _tpause(control, counter);
#else
return 0;
#endif
}

unsigned char umwait(unsigned int ctrl, uint64_t counter) {
#ifdef SUPPORTS_WAITPKG
return _umwait(ctrl, counter);
#else
return 0;
#endif
}

void umonitor(void *a) {
#ifdef SUPPORTS_WAITPKG
_umonitor(a);
#endif
}

uint64_t rdtsc() {
return 0;
}

} // namespace CpuIntrinsics
} // namespace NEO
10 changes: 10 additions & 0 deletions shared/source/utilities/general/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Copyright (C) 2026 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
set_property(GLOBAL APPEND PROPERTY NEO_CORE_UTILITIES
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/cpu_info_general.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cpuintrinsics.cpp
)
15 changes: 15 additions & 0 deletions shared/source/utilities/general/cpu_info_general.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (C) 2021-2026 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

#include "shared/source/utilities/cpu_info.h"

namespace NEO {
void CpuInfo::detect() const {
features = featureNone;
featuresDetected = true;
}
} // namespace NEO
60 changes: 60 additions & 0 deletions shared/source/utilities/general/cpuintrinsics.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (C) 2020-2026 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

#include "shared/source/utilities/cpuintrinsics.h"
#ifdef WIN32
#include <windows.h>
#else
#include <sched.h>
#endif

namespace NEO {
namespace CpuIntrinsics {

void clFlush(void const *ptr) {
__atomic_thread_fence(__ATOMIC_SEQ_CST);
}

void clFlushOpt(void *ptr) {
__atomic_thread_fence(__ATOMIC_SEQ_CST);
}

void sfence() {
__atomic_thread_fence(__ATOMIC_SEQ_CST);
}

void mfence() {
__atomic_thread_fence(__ATOMIC_SEQ_CST);
}

void pause() {
#ifdef WIN32
SwitchToThread();
#else
sched_yield();
#endif
}

uint8_t tpause(uint32_t control, uint64_t counter) {
return 0;
}

unsigned char umwait(unsigned int ctrl, uint64_t counter) {

return 0;
}

void umonitor(void *a) {

}

uint64_t rdtsc() {
return 0;
}

} // namespace CpuIntrinsics
} // namespace NEO
7 changes: 5 additions & 2 deletions shared/source/utilities/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ set(NEO_CORE_UTILITIES_LINUX
)

set_property(GLOBAL PROPERTY NEO_CORE_UTILITIES_LINUX ${NEO_CORE_UTILITIES_LINUX})

add_subdirectories()
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${NEO_TARGET_PROCESSOR}")
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/${NEO_TARGET_PROCESSOR}")
else ()
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/general")
endif ()
12 changes: 12 additions & 0 deletions shared/source/utilities/linux/general/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (C) 2026 Intel Corporation
#
# SPDX-License-Identifier: MIT
#

list(APPEND NEO_CORE_UTILITIES_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/cpu_info.cpp
)

set_property(GLOBAL PROPERTY NEO_CORE_UTILITIES_LINUX ${NEO_CORE_UTILITIES_LINUX})
Loading