When header is included for the first time in translation unit,
then preprocessor simply copy-pastes its content. If we define a
constant in a header file and this constant has internal linkage
then each and every translation unit, which includes this header
will have its own copy of this constant.
C++17 introduces inline variables, which are meant to allow creation
of variables in header files, which do not cause multiple instances.
The inline variable has a single instance when:
- constexpr is used without static (constexpr implicitly implies inline)
- inline is used without static
- inline const is used without static (const does not imply internal linkage
when used with inline)
Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
Set missing pointer size for argument type buffer address in zebin.
This PR is related to test failures after merging corresponding IGC
change.
Related-To: IGC-5486
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit adds support for sampler's metadata in zebinary and
updates some image's metadata field names.
Resolves: NEO-7257
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
Usage of initializer list in for loop to iterate over heavy types
has bad consequences. std::initialize_list is only a view and its
data is silently created as T[N]. Therefore, if someone uses
std::vector with it, it will cause deep-copying of the elements.
This change introduces usage of pointers on std::initializer_list
to perform a shallow-copy of an addresses. Furthermore, it adds
const references in few places, where copy is not needed.
Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
This commit simplifies parsing of enums in zebin decoder and removes
unnecessary tests.
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
When an IntelGT note type is not recognized, skip it instead of
returning negative target device validating result.
Related-To: NEO-7190
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit adds support for new ZEBinary ELF versioning mechanism.
- Add new IntelGTSecionType: ZebinVersion
- Add mechanism for retrieving zeInfo/elf version in intel.notegt
section
Related-To: NEO-7190
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This change is needed to bump zeInfo version beyond 1.6
- Version 1.6: Remove actual_kernel_start_offset from execution environment.
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit removes unnecessary container size manipulation in yaml
parser. Space reservation is done by dedicated function
reserveBasedOnEstimates, so there is no need to manually resize the
container's size afterwards.
- Ensure that no invalidated iterators/references are used.
- Use push_back() instead of resize(...size()+1).
- Use reserveBasedOnEstimates() instead of reserve(...size()+1)
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
Ocloc will handle any new values that may be
passed to the -device argument.
Supported acronyms are available under cmd:
ocloc compile --help
Supported patterns:
- device acronym
- release acronym
- family acronym
- version (major.minor.revision)
Fatbinary will no longer handle major.minor.revision variances,
only acronyms allowed.
Signed-off-by: Daria Hinz <daria.hinz@intel.com>
GDB requires debug zebin to be an absolute ELF. This change adds setting
symbols values to absolute addresses allowing GDB to work correctly.
Resolves: NEO-7097
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
Ocloc will handle any new values that may be
passed to the -device argument.
Supported acronyms are available under cmd:
ocloc compile --help
Supported patterns:
- device acronym
- release acronym
- family acronym
- version (major.minor.revision)
Fatbinary will no longer handle major.minor.revision variances,
only acronyms allowed.
Signed-off-by: Daria Hinz <daria.hinz@intel.com>
This change adds support for new "buffer_address" arg type, which adds
buffer address information for stateful-only argument. This will prevent
from generating stateless version of a kernel argument if all its
accesses are to be promoted to the stateful ones.
- Change default value of accessedUsingStatelessAddressingMode flag.
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
Related-To: NEO-7048
- Packed Binary Returned to a customer in L0 GetNative is now
the target device's native binary.
Signed-off-by: Neil R Spruit <neil.r.spruit@intel.com>
This change:
* adds functions for setting members of ElfSymbol, and ElfRela.
* simplifies string section creation in ElfEncoder.
* adds function to query index of section in ElfEncoder.
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This change:
* Adds support for build options section in zebinary - using
build options in binary when rebuilding.
* Appends "-cl-intel-allow-zebin" flag to build options when zebin is
used.
Resolves: NEO-6916
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
Do not apply relocations with types different than {1, 2, 3}, when creating
debug zebin.
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit prevents a yaml parsing error in case a data type is passed
after empty vetor type data entry with the same indendation. In this
case, a parsing error will be returned.
- Corrected .ze_info section in valid empty program (zebin mock)
- Minor ults refactor in order to use mock zebin program with valid
.ze_info
Related-To: NEO-6735
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
feat: Set text sections' addresses with valid GPU VA. Offset debug symbols
with text segment names by corresponding segment's GPU VA.
Resolves: NEO-6873
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
Previous change regarding NEO-6785 added encoding of number of barriers
to specific value representation depending on hardware that we program for.
In patch token format encoding of number of barriers is sent via
hasBarriers field in a token.
In zebin true number of barriers is sent via barrier_count field in
zeInfo.
To remove this discrepancy, translate encoded number of barriers into
true number of barriers in legacy format.
Resolves: NEO-6785
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commits adds rebuilding zebin binary.
If zebin is built for different device and has SPIRV, then new ze binary
will be built using SPIRV.
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
Change modifies the encoding entry in fatbinary for platforms.
If numbering in -device is used, the value PRODUCT_CONFIG will be encoded.
The functionality that returns the correct product config values has
also been added.
Related-To: NEO-6744
Signed-off-by: Daria Hinz <daria.hinz@intel.com>
This commit:
- Optimizes usage of std::unordered map
- Corrects variables naming and output messages
- Minor changes in using std::string methods
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit removes custom definition of
_PATCH_TOKEN_GLOBAL_HOST_ACCESS_TABLE and
instead uses one provided by IGC.
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit moves patch token with global host access table to the
kernel scope from the program scope.
Related-To: NEO-6734
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit removes ZebinTargetMetadata struct, and uses
ZebinTargetFlags for both target validations: via machine type, and
via intel gt notes.
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit enables parsing symbol infos
passed in the PATCH_TOKEN_PROGRAM_SYMBOL_TABLE patchtoken.
Related-To: NEO-6734
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This change allows for modifying kernel's barrier count
based on called external functions metadata passed
via zeInfo section in zebin.
Added parsing external functions metadata.
Added resolving external functions call graph.
Added updating kernel barriers based on called external functions.
Added support for L0 dynamic link.
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit adds support for querying global pointers via decorated
names passed in zeInfo.
Related-To: NEO-6734
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit fixes generating localIDs in zebin.
With thix fix, Emit Local in compute walker will be set accordingly with
the size of local_id argtype (currently, Emit Local is set to Emit None,
which prevents generating local IDs).
Related-To: NEO-6089
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit fixes generating localIDs in zebin.
With thix fix, Emit Local in compute walker will be set accordingly with
the size of local_id argtype (currently, Emit Local is set to Emit None,
which prevents generating local IDs).
Related-To: NEO-6089
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit fixes setting usesStringMap flag for printf, taking into
account using indirect functions in legacy (non-zebinary) path. It also
adds new field to kernelDescriptor, specifying the binary type
(legacy/zebin).
Related-To: NEO-6604
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This change prevents embedding identical SPIR-V section for each
target requested in fatbinary build. Instead of duplicating SPIR-V,
a new file called 'generic_ir' is added to AR archive. It contains
SPIR-V, which was used to build fatbinary. Build fallback in runtime
has been also adjusted - if 'generic_ir' file is defined in fatbinary
and there is no matching binary, then this generic SPIR-V is used to
rebuild for the requested target.
Additionally, MockOclocArgumentHelper::loadDataFromFile() was adjusted
to ensure null-termination of returned strings.
This change also removes possible undefined behavior, which was
related to reading names of files from AR archive. Previously,
if filename was shorter than requested target name, we tried to
read more memory than allowed.
Related-To: NEO-6490
Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
In OCL product family of target device is not set
which leads to a fail on validating target device in
ZEBin path.
This change adds function that sets all
necessary fields based on provided hardware info.
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
If kernel has no stateless indirect accesses don't set the
kernelHasIndirectAccess flag.
Don't make resident or migrate if kernel has no indirect accesses.
Changed initial values in KernelAttributes.
Related-To: NEO-6597
Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
- ELF type is EXEC
- Absolute GPU addresses in program headers as load addresses
- All relocations are applied (not only for debug info as before)
- Default section alignment for debug zebin is set to 4,
this fix the problem with .notes section parsing
Related-To: NEO-5571
Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
If kernel has no stateless indirect accesses don't set the
kernelHasIndirectAccess flag.
Don't make resident or migrate if kernel has no indirect accesses.
Changed initial values in KernelAttributes.
Related-To: NEO-6597
Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit adds debug zebin creation in OCL.
- Added returning debug zebin in build/linking paths in OCL if
corresponding device binary format was detected.
- Refactored getZebinSegments() method - added common ctor for both
L0/OCL paths
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
When encoding ELF binary sort program headers by
virtual addresses incrementally.
This change is needed for compatibility with GDB.
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
If a kernel has ray tracing calls, we allocate and initialize
per-device RTDispatchGlobals if needed, and hand off pointer to
the same into a running kernel via an implicit parameter.
Related-To: NEO-5384
Signed-off-by: Jim Snow <jim.m.snow@intel.com>
Added test checking population of Kernel Descriptor with default
execution environment values.
Sorting.
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
Creates copy of zebinary with program headers containing
addresses of segments and applies debug relocations.
Related-To: NEO-6071
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
Add support for decoding required work group size and work gorup walk
order dimensions in zebin.
Related-To: NEO-6088
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
Change LinkerInput::RelocationInfo::Type to be compliant with zebin
relocation types.
Add support for setting relocation type if zebin relocation
type is set.
Continue supporting R_AMD64_64 and R_AMD64_32 relocation types for
backward compatibility
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
Add extraction of IntelGT note section in zebin decoder.
Add target validation based on intelGT notes in zebin decoder.
Add check in unpacking (unpackSingleDeviceBinary) for e_machine,
and validate target device accordingly.
Related-To: NEO-5658
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
Dates corrected in copyright headers to reflect original publication date
(2018 for OpenCL, 2020 for Level Zero).
Signed-off-by: lgotszal <lukasz.gotszald@intel.com>
Read zebin experimental properties indicating whether a kernel has
indirect access and if so, ignore calls to zeKernelSetIndirectAccess.
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>