@@ -823,11 +823,10 @@ template <bundle_state State>
823
823
class kernel_bundle {
824
824
// Continued from "New kernel bundle member functions"
825
825
826
- bool ext_oneapi_has_device_global(const std::string &name, const device &dev );
826
+ bool ext_oneapi_has_device_global(const std::string &name);
827
827
void *ext_oneapi_get_device_global_address(const std::string &name,
828
828
const device &dev);
829
- size_t ext_oneapi_get_device_global_size(const std::string &name,
830
- const device &dev);
829
+ size_t ext_oneapi_get_device_global_size(const std::string &name);
831
830
};
832
831
833
832
} // namespace sycl
840
839
a!
841
840
[source,c++]
842
841
----
843
- bool ext_oneapi_has_device_global(const std::string &name, const device &dev )
842
+ bool ext_oneapi_has_device_global(const std::string &name)
844
843
----
845
844
!====
846
845
@@ -852,8 +851,7 @@ _Returns:_ The value `true` only if
852
851
* the kernel bundle was created from a bundle of state
853
852
`bundle_state::ext_oneapi_source` in the language `source_language::sycl`, and
854
853
* it defines a device global whose name is `name` and which was declared without
855
- the `device_image_scope` property, and
856
- * `dev` is contained by the context associated with this bundle.
854
+ the `device_image_scope` property.
857
855
858
856
`name` must be a {cpp} identifier that is valid for referencing the device
859
857
global at the bottom of the source code.
@@ -872,16 +870,20 @@ void *ext_oneapi_get_device_global_address(const std::string &name,
872
870
_Constraints:_ This function is not available when `State` is
873
871
`bundle_state::ext_oneapi_source`.
874
872
875
- _Effects :_ If device memory for `name` has not been allocated at the time of
876
- this call, it will be allocated and zero-initialized synchronously .
873
+ _Returns :_ A device USM pointer to the storage for the device global `name` on
874
+ device `dev` .
877
875
878
- _Returns:_ Returns a USM pointer to the device global `name`'s storage on device
879
- `dev`.
876
+ _Remarks:_ The contents of the device global may be read or written from the
877
+ host by reading from or writing to this address. If the address is read before
878
+ any kernel writes to the device global, the read operation returns the device
879
+ global's initial value.
880
880
881
881
_Throws:_
882
882
883
883
* An `exception` with the `errc::invalid` error code if
884
- `ext_oneapi_has_device_global(name, dev)` returns `false`.
884
+ `ext_oneapi_has_device_global(name)` returns `false`.
885
+ * An `exception` with the `errc::invalid` error code if the context associated
886
+ with this bundle does not contain device `dev`.
885
887
* An `exception` with the `errc::memory_allocation` error code if the allocation
886
888
or initialization of the device global's storage fails.
887
889
891
893
a!
892
894
[source,c++]
893
895
----
894
- size_t ext_oneapi_get_device_global_size(const std::string &name,
895
- const device &dev)
896
+ size_t ext_oneapi_get_device_global_size(const std::string &name)
896
897
----
897
898
!====
898
899
899
900
_Constraints:_ This function is not available when `State` is
900
901
`bundle_state::ext_oneapi_source`.
901
902
902
- _Returns:_ Returns the size in bytes of device global `name`.
903
+ _Returns:_ The size in bytes of the USM storage for device global `name`.
903
904
904
905
_Throws:_
905
906
906
907
* An `exception` with the `errc::invalid` error code if
907
- `ext_oneapi_has_device_global(name, dev )` returns `false`.
908
+ `ext_oneapi_has_device_global(name)` returns `false`.
908
909
|====
909
910
910
911
@@ -1080,8 +1081,7 @@ int main() {
1080
1081
float scale = 0.1f;
1081
1082
void *scale_addr =
1082
1083
kb_exe.ext_oneapi_get_device_global_address("scale", q.get_device());
1083
- size_t scale_size =
1084
- kb_exe.ext_oneapi_get_device_global_size("scale", q.get_device());
1084
+ size_t scale_size = kb_exe.ext_oneapi_get_device_global_size("scale");
1085
1085
q.memcpy(scale_addr, &scale, scale_size).wait();
1086
1086
1087
1087
// Get the kernel via its compiler-generated name, and launch it as before.
0 commit comments