fixes for events in rf hist_random#3667
Open
Alexandr-Solovev wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
/intelci: run |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes host/device ordering for per-node random data generation in the GPU histogram-based Random Forest training path by ensuring the generated feature lists and thresholds are properly transferred to device memory and ordered via SYCL events.
Changes:
gen_feature_list: generate selected features on host, then copy into a device allocation and return the copy event.gen_random_thresholds: generate random thresholds on host, then copy into a device allocation and return the copy event.- Training loop: stop waiting on empty events; instead, pass the returned copy events as dependencies into
compute_best_split.
Comment on lines
+512
to
+520
| auto selected_features_com = | ||
| pr::ndarray<Index, 1>::empty(queue_, | ||
| { node_count * ctx.selected_ftr_count_ }, | ||
| alloc::device); | ||
| auto copy_event = selected_features_com.assign_from_host(queue_, | ||
| selected_features_host_ptr, | ||
| selected_features_host.get_count()); | ||
|
|
||
| return std::tuple{ selected_features_com, copy_event }; |
Comment on lines
+546
to
+553
| auto random_bins_com = pr::ndarray<Float, 1>::empty(queue_, | ||
| { node_count * ctx.selected_ftr_count_ }, | ||
| alloc::device); | ||
| auto copy_event = random_bins_com.assign_from_host(queue_, | ||
| random_bins_host_ptr, | ||
| random_bins_host.get_count()); | ||
|
|
||
| return std::tuple{ random_bins_com, copy_event }; |
Comment on lines
534
to
535
| auto node_vs_tree_map_list_host = node_vs_tree_map.to_host(queue_); | ||
|
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes a host/device memory ordering hazard in the GPU histogram-based Random Forest training kernel. The two helpers that produce per-node random data for split selection (
gen_feature_listandgen_random_thresholds) were filling shared-USM buffers on the host and returning an emptysycl::event, then the caller blocked the host onevent.wait_and_throw()before launching the consumer kernel. With shared USM, host writes that race a device kernel on the same allocation can be observed inconsistently — and the empty event provided no actual ordering guarantee against subsequent device work.What changed
File:
cpp/oneapi/dal/algo/decision_forest/backend/gpu/train_kernel_hist_impl_dpc.cppgen_feature_listndarray(selected_features_host) instead of shared USM.selected_features_com,alloc::device) and copy host → device withassign_from_host, returning the resultingsycl::event(was previously an empty event).gen_random_thresholdsndarrayfor the RNG fill, then a device buffer +assign_from_hostwhose event is returned.Completeness and readability
Testing
Performance