Skip to content
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

Changed all references and pointers to Handle to be const #3402

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/adam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

namespace miopen {

miopenStatus_t Adam(Handle& handle,
miopenStatus_t Adam(Handle const& handle,
const TensorDescriptor& paramInDesc,
ConstData_t paramIn,
const TensorDescriptor& paramOutDesc,
Expand Down
2 changes: 1 addition & 1 deletion src/addlayernorm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

namespace miopen {

miopenStatus_t AddLayerNormForward(Handle& handle,
miopenStatus_t AddLayerNormForward(Handle const& handle,
const TensorDescriptor& xDesc,
ConstData_t x,
const TensorDescriptor& x2Desc,
Expand Down
2 changes: 1 addition & 1 deletion src/cat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

namespace miopen {

miopenStatus_t CatForward(Handle& handle,
miopenStatus_t CatForward(Handle const& handle,
int32_t xCount,
const TensorDescriptor* const* xDescs,
ConstData_t* xs,
Expand Down
2 changes: 1 addition & 1 deletion src/conv/solver_finders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ const std::vector<std::unique_ptr<ISolversFinder>>& GetConvSolverFinders()
} // namespace conv

/// Register invoker only for the best solution within algorithm.
static std::vector<Solution> EvaluateInvokers(Handle& handle,
static std::vector<Solution> EvaluateInvokers(Handle const& handle,
const std::vector<solver::ConvSolution>& solutions,
const AlgorithmName& algorithm_name,
const NetworkConfig& network_config,
Expand Down
2 changes: 1 addition & 1 deletion src/ctc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ CTCLossDescriptor::CTCLossDescriptor()
blank_label_id = 0;
}

size_t CTCLossDescriptor::GetCTCLossWorkspaceSize(Handle& handle,
size_t CTCLossDescriptor::GetCTCLossWorkspaceSize(Handle const& handle,
const TensorDescriptor& probsDesc,
const TensorDescriptor& gradientsDesc,
const int* labels,
Expand Down
12 changes: 7 additions & 5 deletions src/find_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ boost::optional<fs::path>& testing_find_db_path_override()

#if MIOPEN_EMBED_DB
template <class TDb>
fs::path FindDbRecord_t<TDb>::GetInstalledPathEmbed(Handle& handle, const std::string& path_suffix)
fs::path FindDbRecord_t<TDb>::GetInstalledPathEmbed(Handle const& handle,
const std::string& path_suffix)
{
static const auto embed_path = [&] {
const std::string ext = ".fdb.txt";
Expand Down Expand Up @@ -121,7 +122,8 @@ fs::path FindDbRecord_t<TDb>::GetInstalledPathEmbed(Handle& handle, const std::s
#else

template <class TDb>
fs::path FindDbRecord_t<TDb>::GetInstalledPathFile(Handle& handle, const std::string& path_suffix)
fs::path FindDbRecord_t<TDb>::GetInstalledPathFile(Handle const& handle,
const std::string& path_suffix)
{
static const auto installed_path = [&] {
const std::string ext = ".fdb.txt";
Expand Down Expand Up @@ -197,7 +199,7 @@ fs::path FindDbRecord_t<TDb>::GetInstalledPathFile(Handle& handle, const std::st
}
#endif
template <class TDb>
fs::path FindDbRecord_t<TDb>::GetInstalledPath(Handle& handle, const std::string& path_suffix)
fs::path FindDbRecord_t<TDb>::GetInstalledPath(Handle const& handle, const std::string& path_suffix)
{
#if !MIOPEN_DISABLE_SYSDB
#if MIOPEN_EMBED_DB
Expand All @@ -213,7 +215,7 @@ fs::path FindDbRecord_t<TDb>::GetInstalledPath(Handle& handle, const std::string
}

template <class TDb>
fs::path FindDbRecord_t<TDb>::GetUserPath(Handle& handle, const std::string& path_suffix)
fs::path FindDbRecord_t<TDb>::GetUserPath(Handle const& handle, const std::string& path_suffix)
{
#if !MIOPEN_DISABLE_USERDB
return GetUserDbPath() / (handle.GetDbBasename() + '.' + GetUserDbSuffix() +
Expand All @@ -226,7 +228,7 @@ fs::path FindDbRecord_t<TDb>::GetUserPath(Handle& handle, const std::string& pat
}

template <class TDb>
bool FindDbRecord_t<TDb>::Validate(Handle& handle, const NetworkConfig& config) const
bool FindDbRecord_t<TDb>::Validate(Handle const& handle, const NetworkConfig& config) const
{
auto unbuilt = false;
auto any = false;
Expand Down
10 changes: 5 additions & 5 deletions src/fusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

namespace miopen {

miopenStatus_t ConvBiasActivFusion(Handle& handle,
miopenStatus_t ConvBiasActivFusion(Handle const& handle,
const void* alpha1,
const TensorDescriptor& xDesc,
ConstData_t x,
Expand Down Expand Up @@ -137,7 +137,7 @@ miopenStatus_t ConvBiasActivFusion(Handle& handle,
}

static auto
AllocateBuffersAndMakeFusionInvokeParams(Handle& handle,
AllocateBuffersAndMakeFusionInvokeParams(Handle const& handle,
const FusionDescription& problem,
std::vector<Allocator::ManageDataPtr>& invoke_bufs,
miopen::OperatorArgs& params,
Expand Down Expand Up @@ -490,7 +490,7 @@ TensorDescriptor FusionPlanDescriptor::FusionPlanDescriptor::DeriveOutputDescrip
return o_desc;
}

miopenStatus_t FusionPlanDescriptor::GetWorkspaceSizeImmed(Handle& handle,
miopenStatus_t FusionPlanDescriptor::GetWorkspaceSizeImmed(Handle const& handle,
size_t& workSpaceSize,
miopenConvFwdAlgorithm_t /*algo*/)
{
Expand Down Expand Up @@ -969,7 +969,7 @@ std::vector<miopenConvSolution_t> GetSolutions(const FusionContext& ctx,

} // namespace

miopenStatus_t FusionPlanDescriptor::Compile(Handle& handle)
miopenStatus_t FusionPlanDescriptor::Compile(Handle const& handle)
{
std::vector<Allocator::ManageDataPtr> invoke_bufs;
miopen::OperatorArgs params;
Expand Down Expand Up @@ -1097,7 +1097,7 @@ miopenStatus_t FusionPlanDescriptor::Compile(Handle& handle)
}

std::vector<Solution>
FusionPlanDescriptor::Find(Handle& handle,
FusionPlanDescriptor::Find(Handle const& handle,
const std::function<fusion::FusionInvokeParams()>& invoke_params,
const std::optional<FindOptions>& options) const
{
Expand Down
4 changes: 2 additions & 2 deletions src/getitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

namespace miopen {

std::size_t GetGetitemWorkspaceSize(Handle& handle,
std::size_t GetGetitemWorkspaceSize(Handle const& handle,
uint32_t indexCount,
const TensorDescriptor* const* indexDescs)
{
Expand All @@ -50,7 +50,7 @@ std::size_t GetGetitemWorkspaceSize(Handle& handle,
return pair_size_vector.empty() ? static_cast<size_t>(0) : pair_size_vector.front().second;
}

miopenStatus_t GetitemBackward(Handle& handle,
miopenStatus_t GetitemBackward(Handle const& handle,
Data_t workspace,
size_t workspaceSizeInBytes,
const TensorDescriptor& dyDesc,
Expand Down
4 changes: 2 additions & 2 deletions src/glu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace miopen {

namespace glu {

miopenStatus_t GLUForward(Handle& handle,
miopenStatus_t GLUForward(Handle const& handle,
const TensorDescriptor& inputDesc,
ConstData_t input,
const TensorDescriptor& outputDesc,
Expand Down Expand Up @@ -65,7 +65,7 @@ miopenStatus_t GLUForward(Handle& handle,
return miopenStatusSuccess;
}

miopenStatus_t GLUBackward(Handle& handle,
miopenStatus_t GLUBackward(Handle const& handle,
const TensorDescriptor& inputDesc,
ConstData_t input,
const TensorDescriptor& outputGradDesc,
Expand Down
2 changes: 1 addition & 1 deletion src/groupnorm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

namespace miopen {

miopenStatus_t GroupNormForward(Handle& handle,
miopenStatus_t GroupNormForward(Handle const& handle,
const TensorDescriptor& xDesc,
ConstData_t x,
const TensorDescriptor& weightDesc,
Expand Down
2 changes: 1 addition & 1 deletion src/hip/handlehip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ std::size_t Handle::GetWavefrontWidth() const

// No HIP API that could return maximum memory allocation size
// for a single object.
std::size_t Handle::GetMaxMemoryAllocSize()
std::size_t Handle::GetMaxMemoryAllocSize() const
{
if(m_MaxMemoryAllocSizeCached == 0)
{
Expand Down
4 changes: 2 additions & 2 deletions src/include/miopen/activ.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct MIOPEN_INTERNALS_EXPORT ActivationDescriptor : miopenActivationDescriptor
double GetBeta() const;
double GetGamma() const;

miopenStatus_t Forward(Handle& handle,
miopenStatus_t Forward(Handle const& handle,
const void* alpha,
const TensorDescriptor& xDesc,
ConstData_t x,
Expand All @@ -60,7 +60,7 @@ struct MIOPEN_INTERNALS_EXPORT ActivationDescriptor : miopenActivationDescriptor
size_t xOffset = 0,
size_t yOffset = 0) const;

miopenStatus_t Backward(Handle& handle,
miopenStatus_t Backward(Handle const& handle,
const void* alpha,
const TensorDescriptor& yDesc,
ConstData_t y,
Expand Down
4 changes: 2 additions & 2 deletions src/include/miopen/adam.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace miopen {
struct Handle;
struct TensorDescriptor;

MIOPEN_INTERNALS_EXPORT miopenStatus_t Adam(Handle& handle,
MIOPEN_INTERNALS_EXPORT miopenStatus_t Adam(Handle const& handle,
const TensorDescriptor& paramInDesc,
ConstData_t paramIn,
const TensorDescriptor& paramOutDesc,
Expand Down Expand Up @@ -74,7 +74,7 @@ MIOPEN_INTERNALS_EXPORT miopenStatus_t Adam(Handle& handle,
bool is_amp);

MIOPEN_INTERNALS_EXPORT miopenStatus_t
TransformersAdamW(Handle& handle,
TransformersAdamW(Handle const& handle,
const TensorDescriptor& paramInDesc,
ConstData_t paramIn,
const TensorDescriptor& paramOutDesc,
Expand Down
2 changes: 1 addition & 1 deletion src/include/miopen/addlayernorm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace miopen {
struct Handle;
struct TensorDescriptor;

MIOPEN_INTERNALS_EXPORT miopenStatus_t AddLayerNormForward(Handle& handle,
MIOPEN_INTERNALS_EXPORT miopenStatus_t AddLayerNormForward(Handle const& handle,
const TensorDescriptor& xDesc,
ConstData_t x,
const TensorDescriptor& x2Desc,
Expand Down
6 changes: 3 additions & 3 deletions src/include/miopen/batch_norm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void bnFwdTrainSelectMulti(const Handle& handle,

void profileSequence(const Handle& handle, unsigned char select, float* ctime);

MIOPEN_INTERNALS_EXPORT void BatchNormForwardInference(Handle& handle,
MIOPEN_INTERNALS_EXPORT void BatchNormForwardInference(Handle const& handle,
miopenBatchNormMode_t bn_mode,
const void* alpha,
const void* beta,
Expand All @@ -181,7 +181,7 @@ MIOPEN_INTERNALS_EXPORT void BatchNormForwardInference(Handle& handle,
ConstData_t estimatedVariance,
double epsilon);

MIOPEN_INTERNALS_EXPORT void BatchNormForwardTraining(Handle& handle,
MIOPEN_INTERNALS_EXPORT void BatchNormForwardTraining(Handle const& handle,
miopenBatchNormMode_t bn_mode,
const void* alpha,
const void* beta,
Expand All @@ -202,7 +202,7 @@ MIOPEN_INTERNALS_EXPORT void BatchNormForwardTraining(Handle& handle,
Data_t resultSaveMean,
Data_t resultSaveInvVariance);

MIOPEN_INTERNALS_EXPORT void BatchNormBackward(Handle& handle,
MIOPEN_INTERNALS_EXPORT void BatchNormBackward(Handle const& handle,
miopenBatchNormMode_t bn_mode,
const void* alphaDataDiff,
const void* betaDataDiff,
Expand Down
2 changes: 1 addition & 1 deletion src/include/miopen/cat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace miopen {
struct Handle;
struct TensorDescriptor;

MIOPEN_INTERNALS_EXPORT miopenStatus_t CatForward(Handle& handle,
MIOPEN_INTERNALS_EXPORT miopenStatus_t CatForward(Handle const& handle,
int32_t xCount,
const TensorDescriptor* const* xDescs,
ConstData_t* xs,
Expand Down
22 changes: 11 additions & 11 deletions src/include/miopen/convolution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ struct MIOPEN_INTERNALS_EXPORT ConvolutionDescriptor : miopenConvolutionDescript
std::size_t GetWorkSpaceSize(ExecutionContext ctx,
const conv::ProblemDescription& problem) const;

void FindConvFwdAlgorithm(Handle& handle,
void FindConvFwdAlgorithm(Handle const& handle,
const TensorDescriptor& xDesc,
ConstData_t x,
const TensorDescriptor& wDesc,
Expand All @@ -211,7 +211,7 @@ struct MIOPEN_INTERNALS_EXPORT ConvolutionDescriptor : miopenConvolutionDescript
std::size_t workSpaceSize,
bool exhaustiveSearch) const;

void ConvolutionForward(Handle& handle,
void ConvolutionForward(Handle const& handle,
const void* alpha,
const TensorDescriptor& xDesc,
ConstData_t x,
Expand All @@ -238,13 +238,13 @@ struct MIOPEN_INTERNALS_EXPORT ConvolutionDescriptor : miopenConvolutionDescript
const conv::ProblemDescription& problem,
solver::Id solver_id) const;

std::size_t GetForwardSolutionWorkspaceSize(Handle& handle,
std::size_t GetForwardSolutionWorkspaceSize(Handle const& handle,
const TensorDescriptor& wDesc,
const TensorDescriptor& xDesc,
const TensorDescriptor& yDesc,
solver::Id solver_id) const;

void ConvolutionForwardImmediate(Handle& handle,
void ConvolutionForwardImmediate(Handle const& handle,
const TensorDescriptor& wDesc,
ConstData_t w,
const TensorDescriptor& xDesc,
Expand All @@ -255,7 +255,7 @@ struct MIOPEN_INTERNALS_EXPORT ConvolutionDescriptor : miopenConvolutionDescript
std::size_t workSpaceSize,
solver::Id solver_id) const;

void FindConvBwdDataAlgorithm(Handle& handle,
void FindConvBwdDataAlgorithm(Handle const& handle,
const TensorDescriptor& dyDesc,
ConstData_t dy,
const TensorDescriptor& wDesc,
Expand All @@ -269,7 +269,7 @@ struct MIOPEN_INTERNALS_EXPORT ConvolutionDescriptor : miopenConvolutionDescript
std::size_t workSpaceSize,
bool exhaustiveSearch) const;

void ConvolutionBackwardData(Handle& handle,
void ConvolutionBackwardData(Handle const& handle,
const void* alpha,
const TensorDescriptor& dyDesc,
ConstData_t dy,
Expand All @@ -282,13 +282,13 @@ struct MIOPEN_INTERNALS_EXPORT ConvolutionDescriptor : miopenConvolutionDescript
Data_t workSpace,
std::size_t workSpaceSize) const;

std::size_t GetBackwardSolutionWorkspaceSize(Handle& handle,
std::size_t GetBackwardSolutionWorkspaceSize(Handle const& handle,
const TensorDescriptor& dyDesc,
const TensorDescriptor& wDesc,
const TensorDescriptor& dxDesc,
solver::Id solver_id) const;

void ConvolutionBackwardImmediate(Handle& handle,
void ConvolutionBackwardImmediate(Handle const& handle,
const TensorDescriptor& dyDesc,
ConstData_t dy,
const TensorDescriptor& wDesc,
Expand All @@ -299,13 +299,13 @@ struct MIOPEN_INTERNALS_EXPORT ConvolutionDescriptor : miopenConvolutionDescript
std::size_t workSpaceSize,
solver::Id solver_id) const;

std::size_t GetWrwSolutionWorkspaceSize(Handle& handle,
std::size_t GetWrwSolutionWorkspaceSize(Handle const& handle,
const TensorDescriptor& dyDesc,
const TensorDescriptor& xDesc,
const TensorDescriptor& dwDesc,
solver::Id solver_id) const;

void ConvolutionWrwImmediate(Handle& handle,
void ConvolutionWrwImmediate(Handle const& handle,
const TensorDescriptor& dyDesc,
ConstData_t dy,
const TensorDescriptor& xDesc,
Expand All @@ -316,7 +316,7 @@ struct MIOPEN_INTERNALS_EXPORT ConvolutionDescriptor : miopenConvolutionDescript
std::size_t workSpaceSize,
solver::Id solver_id) const;

void FindConvBwdWeightsAlgorithm(Handle& handle,
void FindConvBwdWeightsAlgorithm(Handle const& handle,
const TensorDescriptor& dyDesc,
ConstData_t dy,
const TensorDescriptor& xDesc,
Expand Down
4 changes: 2 additions & 2 deletions src/include/miopen/ctc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ struct MIOPEN_INTERNALS_EXPORT CTCLossDescriptor : miopenCTCLossDescriptor
bool apply_softmax_layer;
int blank_label_id;

size_t GetCTCLossWorkspaceSize(Handle& handle,
size_t GetCTCLossWorkspaceSize(Handle const& handle,
const TensorDescriptor& probsDesc,
const TensorDescriptor& gradientsDesc,
const int* labels,
const int* labelLengths,
const int* inputLengths,
miopenCTCLossAlgo_t algo) const;

void CTCLoss(Handle& handle,
void CTCLoss(Handle const& handle,
const TensorDescriptor& probsDesc,
ConstData_t probs,
const int* labels,
Expand Down
2 changes: 1 addition & 1 deletion src/include/miopen/dropout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct MIOPEN_INTERNALS_EXPORT DropoutDescriptor : miopenDropoutDescriptor

miopenDataType_t dataType_;

void InitPRNGState(Handle& handle,
void InitPRNGState(Handle const& handle,
Data_t prng_states,
size_t prng_stateSizeInBytes,
unsigned long long prng_seed) const;
Expand Down
Loading
Loading