-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add experimental extension to query mem properties of sorting kernels #127
Open
jandres742
wants to merge
2
commits into
oneapi-src:master
Choose a base branch
from
jandres742:sortingalgorithms
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<% | ||
import re | ||
from templates import helper as th | ||
%><% | ||
OneApi=tags['$OneApi'] | ||
x=tags['$x'] | ||
X=x.upper() | ||
%> | ||
:orphan: | ||
|
||
.. _ZE_experimental_device_group_algorithm_memory_properties: | ||
|
||
======================================================== | ||
Group Algorithm Memory Properties Experimental Extension | ||
======================================================== | ||
|
||
API | ||
---- | ||
|
||
* Enumerations | ||
|
||
* ${x}_device_group_algorithm_memory_properties_exp_version_t | ||
* ${x}_group_algorithm_type_exp_t | ||
* ${x}_group_algorithm_memory_scope_exp_t | ||
|
||
* Structures | ||
|
||
|
||
* ${x}_device_group_algorithm_memory_exp_properties_t | ||
|
||
* Functions | ||
|
||
|
||
* ${x}DeviceGetGroupAlgorithmMemoryPropertiesExp | ||
|
||
|
||
Group Algorithm Memory Properties | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
This extension allows applications to query for memory requirements of | ||
the underlying compiler when selecting a particular group algorithm in | ||
their kernels. Specifically, this extension returns the global memory | ||
size and shared local memory size that applications need to allocate | ||
and pass as a parameter to a group algorithm that requires additional | ||
memory. | ||
|
||
Three types of algorithms are available: | ||
|
||
${X}_GROUP_ALGORITHM_TYPE_EXP_SORT: sorting algorithm | ||
|
||
${X}_GROUP_ALGORITHM_TYPE_EXP_SCAN: scan algorithm | ||
|
||
${X}_GROUP_ALGORITHM_TYPE_EXP_REDUCE: reduce algorithm | ||
|
||
To know what amount of memory, application would call this extension as | ||
follows: | ||
|
||
.. parsed-literal:: | ||
|
||
${x}_device_group_algorithm_memory_exp_properties_t groupAlgorithmMemoryProperties {}; | ||
groupAlgorithmMemoryProperties.stype = ${X}_STRUCTURE_TYPE_DEVICE_GROUP_ALGORITHM_MEMORY_EXP_PROPERTIES; | ||
groupAlgorithmMemoryProperties.algorithm = ${X}_GROUP_ALGORITHM_TYPE_EXP_SORT; | ||
groupAlgorithmMemoryProperties.memoryScope = ${X}_GROUP_ALGORITHM_MEMORY_SCOPE_EXP_SUBGROUP; | ||
|
||
${x}_result_t res = ${x}DeviceGetGroupAlgorithmMemoryPropertiesExp(hDevice, numOfElements, &groupAlgorithmMemoryProperties); | ||
|
||
|
||
Upon return, groupAlgorithmMemoryProperties will contain in | ||
globalMemorySize and sharedLocalMemorySize the global and | ||
shared local memory needed, respectively, for executing the selected | ||
algorithm in the target device. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# | ||
# Copyright (C) 2023 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: MIT | ||
# | ||
# See YaML.md for syntax definition | ||
# | ||
--- #-------------------------------------------------------------------------- | ||
type: header | ||
desc: "Intel $OneApi Level-Zero Extension APIs for Querying Memory Properties of Group Algorithms" | ||
version: "1.6" | ||
--- #-------------------------------------------------------------------------- | ||
type: macro | ||
desc: "Group Algorithm Memory Properties Extension Name" | ||
version: "1.6" | ||
name: $X_DEVICE_GROUP_ALGORITHM_MEMORY_PROPERTIES_EXP_NAME | ||
value: '"$X_experimental_device_group_algorithm_memory_properties"' | ||
--- #-------------------------------------------------------------------------- | ||
type: enum | ||
desc: "Group Algorithm Memory Properties version(s)" | ||
version: "1.6" | ||
name: $x_device_group_algorithm_memory_properties_exp_version_t | ||
etors: | ||
- name: "1_0" | ||
value: "$X_MAKE_VERSION( 1, 0 )" | ||
desc: "version 1.0" | ||
--- #-------------------------------------------------------------------------- | ||
type: enum | ||
desc: "Supported group algorithms to be used with $xDeviceGetGroupAlgorithmMemoryPropertiesExp" | ||
version: "1.6" | ||
class: $xDevice | ||
name: $x_group_algorithm_type_exp_t | ||
etors: | ||
- name: SORT | ||
value: "0" | ||
desc: "sorting algorithm" | ||
- name: SCAN | ||
desc: "scan algorithm" | ||
- name: REDUCE | ||
desc: "reduce algorithm" | ||
--- #-------------------------------------------------------------------------- | ||
type: enum | ||
desc: "Supported scopes in group algorithms to be used with $xDeviceGetGroupAlgorithmMemoryPropertiesExp" | ||
version: "1.6" | ||
class: $xDevice | ||
name: $x_group_algorithm_memory_scope_exp_t | ||
etors: | ||
- name: SUBGROUP | ||
value: "0" | ||
desc: "memory scope limited to subgroup" | ||
- name: WORKGROUP | ||
desc: "memory scope limited to workgroup" | ||
--- #-------------------------------------------------------------------------- | ||
type: struct | ||
desc: "Device Group Algorithm Memory Properties" | ||
version: "1.6" | ||
class: $xDevice | ||
name: $x_device_group_algorithm_memory_exp_properties_t | ||
base: $x_base_properties_t | ||
members: | ||
- type: $x_group_algorithm_type_exp_t | ||
name: "algorithm" | ||
desc: "[in] Type of group algorithm" | ||
- type: $x_group_algorithm_memory_scope_exp_t | ||
name: "memoryScope" | ||
desc: "[in] Memory scope of group algorithm" | ||
- type: size_t | ||
name: "globalMemorySize" | ||
desc: "[out] global memory size" | ||
- type: size_t | ||
name: "sharedLocalMemorySize" | ||
desc: "[out] shared local memory size" | ||
details: | ||
- "This structure must be passed to $xDeviceGetGroupAlgorithmMemoryPropertiesExp to obtain the memory properties of a group algorithm." | ||
--- #-------------------------------------------------------------------------- | ||
type: function | ||
desc: "Retrieves memory properties of a group algorithm for the target device." | ||
class: $xDevice | ||
version: "1.6" | ||
name: GetGroupAlgorithmMemoryPropertiesExp | ||
details: | ||
- "The application may call this function from simultaneous threads." | ||
- "The implementation of this function should be lock-free." | ||
params: | ||
- type: $x_device_handle_t | ||
name: hDevice | ||
desc: "[in] handle of the device" | ||
- type: size_t | ||
name: size | ||
wdamon-intel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
desc: "[in] number of elements to process" | ||
- type: "$x_device_group_algorithm_memory_exp_properties_t*" | ||
name: pGroupAlgorithmMemoryProperties | ||
desc: "[in,out] query result for group algorithm memory properties" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: seems, empty line at the end is missed. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we adding some algorithms to Level Zero ?
Is there somewhere more data on the request ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @MichalMrozek . Sent email to you on this.