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

Reimplementation of the 3D Optimizer #8

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Pylata
Copy link
Contributor

@Pylata Pylata commented Jul 9, 2019

No description provided.

@@ -7,6 +7,9 @@ namespace cuFFTAdvisor {

class GeneralTransform {
public:

enum Rank { RANK_1D = 1, RANK_2D = 2, RANK_3D = 3 };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class enum

std::vector<GeneralTransform> *tmp =
optimizeXYZ(in, nBest, maxPercIncrease, squareOnly, crop);
std::vector<GeneralTransform> *tmp;
if(rank == 3){
Copy link
Member

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);
Copy link
Member

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)

std::vector<Polynom> *polysX = generatePolys(tr.X, tr.isFloat, crop);
if(!crop){
std::sort (polysX->begin(), polysX->end());
}else{
Copy link
Member

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);
Copy link
Member

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

size_t found = 0;
for (auto& x : *polysX) {
for (auto& y : *polysY) {
if (squareOnly && (x.value != y.value) && (y.value != 1)) continue;
Copy link
Member

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,
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused

sizeOptimizer.cpp Outdated Show resolved Hide resolved
@@ -7,6 +7,9 @@ namespace cuFFTAdvisor {

class GeneralTransform {
public:

enum Rank { RANK_1D = 1, RANK_2D = 2, RANK_3D = 3 };
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants