Add missing public APIs and replace miopen::deref() in driver#7255
Draft
BradPepersAMD wants to merge 2 commits intousers/brpepers/fix_symbol_leaksfrom
Draft
Add missing public APIs and replace miopen::deref() in driver#7255BradPepersAMD wants to merge 2 commits intousers/brpepers/fix_symbol_leaksfrom
BradPepersAMD wants to merge 2 commits intousers/brpepers/fix_symbol_leaksfrom
Conversation
1864233 to
c567a50
Compare
Add 8 new public API functions to miopen.h: - miopenGetTensorLayout, miopenGetTensorElementSpace, miopenIsTensorPacked, miopenGetTensorVectorLength - miopenGetConvolutionPaddingMode, miopenGetPoolingPaddingMode - miopenSetDebugFlag / miopenGetDebugFlag with miopenDebugFlag_t enum Create common_utils/tensor_utils.hpp with convenience wrappers around the public tensor descriptor API (GetLengths, GetStrides, GetType, GetNumDims, Tien, GetNCDHW, LogRange, GetTypeSize, etc.). Replace 227 of 264 miopen::deref() calls in driver with public API: - Tensor descriptor queries → tensor_utils:: wrappers - Convolution descriptor → miopenGetConvolutionNdDescriptor etc. - Pooling descriptor → miopenSetNdPoolingDescriptor etc. - Dropout descriptor → miopenGetDropoutDescriptor etc. - Debug globals → miopenSetDebugFlag / miopenGetDebugFlag - Handle::Finish() → hipStreamSynchronize(GetStream()) - HipEventPtr → local RAII wrapper in timer.hpp - GetImage3dMaxWidth → hipDeviceGetAttribute Remaining 37 miopen::deref calls require deeper refactoring: - 19 in get_inner_expanded_tv (tensor view refactoring) - 13 in TensorDescriptor value-type usage (mloPoolingHost, mloConvHost) - 3 in .desc member assignments (CBAInferFusion) - 2 in CallGemm (no public GEMM API) Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
Add size_t-based tensor descriptor getter to the public API, matching the existing miopenSetTensorDescriptorV2. This avoids silent truncation of strides that exceed INT_MAX when using the int-based getter. - Add miopenGetTensorDescriptorV2() to miopen.h (beta API) and implement in tensor_api.cpp - Update tensor_utils::GetLengths/GetStrides to use V2 API and return vector<size_t> - Fix tensor_layout.hpp: add missing #include <numeric> - Fix tensor_holder.hpp: add size_t delegating constructor for layout+dims+strides - Fix dropout_gpu_emulator.hpp: define MAX_PRNG_STATE locally after removing miopen/dropout.hpp internal include - Add miopenHandle_t handle parameter to RNN/GRU/LSTM backward verify functions, needed by RunDropoutBackwardEmulator which now uses miopenGetDropoutDescriptor (public API) instead of miopen::deref() Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
27e6464 to
4221fbb
Compare
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
Add 8 new public API functions to
miopen.hand replace 227 of 264miopen::deref()calls in the driver with public API equivalents. Create shared tensor utility wrappers incommon_utils/tensor_utils.hpp.Base branch:
users/brpepers/fix_symbol_leaks(PR #7254)New public API functions
Tensor descriptor
miopenGetTensorLayout()— get tensor layout enummiopenGetTensorElementSpace()— get total element space including stride gapsmiopenIsTensorPacked()— query if tensor is contiguous in memorymiopenGetTensorVectorLength()— get vector length for vectorized layoutsConvolution/Pooling
miopenGetConvolutionPaddingMode()— padding mode getter (was missing)miopenGetPoolingPaddingMode()— padding mode getter (was missing)Debug control
miopenSetDebugFlag()/miopenGetDebugFlag()withmiopenDebugFlag_tenummiopenDebugLoggingQuiet,miopenDebugFindEnforceDisable,miopenDebugIsWarmupOngoing,miopenDebugAlwaysEnableConvDirectNaiveShared convenience wrappers
common_utils/tensor_utils.hppprovidestensor_utils::namespace wrappers:GetLengths,GetStrides,GetType,GetNumDims,GetElementSize,GetLayout,GetElementSpace,IsPacked,GetVectorLengthGetTypeSize,Tien<N>,GetNCDHW,LogRangeUsed by driver, miopen_utils, and tests.
Driver internal dependency reduction
miopen::deref()callsmiopen/includesRemaining 37 deref calls (cannot fix without deeper refactoring)
get_inner_expanded_tv— needs tensor_view refactoring.descmember assignments (CBAInferFusion)CallGemm— no public GEMM API existsTest plan
MIOpenDriver conv -n 1 -c 1 -H 32 -W 32 -k 1 -y 3 -x 3 -V 1🤖 Generated with Claude Code