MIOpen icon indicating copy to clipboard operation
MIOpen copied to clipboard

Forbid inefficient TensorDescriptor initialization

Open CAHEK7 opened this issue 1 year ago • 4 comments

Initializing TensorDescriptor from std::vector<int> is very inefficient due to extra checks and multiple intermediate vector, since internally std::vector<size_t> is used.

Changed all the initializations to the native size_t, removed constructors with std::vector<int> and added workarounds for a legacy descriptors initializations with int's.

It increased performance for the current RNN implementation for a few percents.

CAHEK7 avatar Nov 17 '24 22:11 CAHEK7

Majority of tests heavily rely on vector<int>

CAHEK7 avatar Nov 21 '24 22:11 CAHEK7

@randyspauldingamd I believe this is now your PR :smile:. Does it pass the CI?

averinevg avatar Dec 16 '24 11:12 averinevg

@randyspauldingamd I believe this is now your PR 😄. Does it pass the CI?

It doesn't. The tests, especially old ctests, heavily rely on that int and that's why I've put the comment here https://github.com/ROCm/MIOpen/pull/3424#discussion_r1869914175 - we must not bring the old legacy code into the GTests and there is no excuses (@Vsevolod1983, @BrianHarrisonAMD, could you please check this for any upcoming PRs?)

Fixing old the CTests is a pain in the everywhere. First of all, the template code in the test driver should be adapted (hard but manageable), next - mostly all the ctests should be modified (easy but lots of changes). Good news is - I've already updated various test data configs to be compatible with both int and size_t here https://github.com/ROCm/MIOpen/pull/3416/files#diff-1daaa3cdf3d99199e44b03aea4f80477db07637a62713338f21dd1eec71e8fcd But probably we can get rid of the old tests soon, so the problem disappeared itself.

CAHEK7 avatar Dec 17 '24 00:12 CAHEK7

I just had to open my big mouth...lol. Yeah, I can take this one. I expect I'll get a few of those ctest->gtest conversion tasks after the new year anyway :)

randyspauldingamd avatar Dec 17 '24 15:12 randyspauldingamd

MIOpen is moving to the new monorepo setup and all older unmerged PR's are being closed. Please re-open this as part of the new repo if these changes are still needed.

BradPepersAMD avatar Jul 14 '25 06:07 BradPepersAMD