-
Notifications
You must be signed in to change notification settings - Fork 3
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
Reimplementation of the 3D Optimizer #8
base: master
Are you sure you want to change the base?
Conversation
…"rank" variable in sizeOptimizer
…of double free in sizeOptimizer
…of the crop case in optimizeXYZ_3D
@@ -7,6 +7,9 @@ namespace cuFFTAdvisor { | |||
|
|||
class GeneralTransform { | |||
public: | |||
|
|||
enum Rank { RANK_1D = 1, RANK_2D = 2, RANK_3D = 3 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class enum
sizeOptimizer.cpp
Outdated
std::vector<GeneralTransform> *tmp = | ||
optimizeXYZ(in, nBest, maxPercIncrease, squareOnly, crop); | ||
std::vector<GeneralTransform> *tmp; | ||
if(rank == 3){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compare to enum
optimizeXYZ(in, nBest, maxPercIncrease, squareOnly, crop); | ||
std::vector<GeneralTransform> *tmp; | ||
if(rank == 3){ | ||
tmp = optimizeXYZ_3D(in, nBest, maxPercIncrease, squareOnly, crop); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to decide here. Check it within the optimizeXYZ (and call appropriate version there)
sizeOptimizer.cpp
Outdated
std::vector<Polynom> *polysX = generatePolys(tr.X, tr.isFloat, crop); | ||
if(!crop){ | ||
std::sort (polysX->begin(), polysX->end()); | ||
}else{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep consistent formatting
} else if (tr.Y == tr.Z) { | ||
polysZ = polysY; | ||
} else { | ||
polysZ = generatePolys(tr.Z, tr.isFloat, crop); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repetitive code, please extract helper method
sizeOptimizer.cpp
Outdated
size_t found = 0; | ||
for (auto& x : *polysX) { | ||
for (auto& y : *polysY) { | ||
if (squareOnly && (x.value != y.value) && (y.value != 1)) continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 3D case, x and y should never be == 1
@@ -161,7 +165,85 @@ size_t SizeOptimizer::getMinSize(GeneralTransform &tr, int maxPercDecrease, bool | |||
return std::max(0.f, afterPercInc); | |||
} | |||
|
|||
std::vector<GeneralTransform> *SizeOptimizer::optimizeXYZ(GeneralTransform &tr, | |||
std::vector<GeneralTransform> *SizeOptimizer::optimizeXYZ_3D(GeneralTransform &tr, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that the only difference to 1D/2D case is filtering vs sorting.
Is it true?
If so, pass filtering/sorting method to general
template
optimizeXYZ(..., G &generator)
sizeOptimizer.h
Outdated
@@ -56,10 +66,14 @@ class SizeOptimizer { | |||
|
|||
int getInvocations(Polynom &poly, bool isFloat); | |||
int getInvocationsV8(Polynom &poly, bool isFloat); | |||
std::vector<Polynom> *cutN(std::vector<Polynom>* polys , size_t nBest); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused
@@ -7,6 +7,9 @@ namespace cuFFTAdvisor { | |||
|
|||
class GeneralTransform { | |||
public: | |||
|
|||
enum Rank { RANK_1D = 1, RANK_2D = 2, RANK_3D = 3 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove it from transform.h
No description provided.