Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

fp16 blas implementation patch#5

Merged
gongzg merged 8 commits intointel:fp16from
listenlink:fp16
Feb 8, 2017
Merged

fp16 blas implementation patch#5
gongzg merged 8 commits intointel:fp16from
listenlink:fp16

Conversation

@listenlink
Copy link
Copy Markdown

@listenlink listenlink commented Jan 24, 2017

Hi @gongzg .

This patch implement the fp16 functionality, kernel function/ blas api/ tuning mechanism are all included.
Then can pass all of our clBLAS half test suite.

While I don't add the intelblas_gemm half version currently, because our intel_gemm implementation are still under review at upstream, this PR can be a clean and independent patch for upstream to merge.

}
stream << "{" << std::endl;
stream.inc_tab();

Copy link
Copy Markdown

@ptillet ptillet Jan 24, 2017

Choose a reason for hiding this comment

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

Probably these two branches for the kernel argument can be replaced by:

std::string abdtype = (sdtype=="half")?"float":sdtype

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, will modified with your suggestion


union ISAACAPI values_holder
struct ISAACAPI values_holder
{
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why couldn't we keep a union here? Using a struct instead will multiply the size of the class by 4, which will increase the (already high) overhead associated with expression trees construction and parsing

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is because of the introducing of class half, use struct can avoid compiling error.

Comment thread lib/array.cpp
case FLOAT_TYPE:{float t = v.float32;return t;} break;
case DOUBLE_TYPE: { double t = v.float64;return t;} break;
default: throw unknown_datatype(dtype_);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wouldn't it work to just keep a macro here (if the union is not changed to a struct), even for the half-type?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Current code has to use struct mentioned above, so comment out the macro here.

}
}
}
else{
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Again, I would prefer a single declaration of:
numeric_type abtype = (dtype==HALF_TYPE)?:FLOAT_TYPE:dtype;
over all these branches :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Will follow your suggestion and modified them, thx

Comment thread lib/simple_half.cpp Outdated
INSTANTIATEHALFOP(double)

}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To be honest, I don't understand the purpose of this class, as opposed to some uint16_t, since cl_mem is blind to the underlying datatype anyway.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This class is to add the data type of half and not just the type define of uint16_t. With the help of this class, we can let the code see "half" in the process without compiling errors.

@listenlink
Copy link
Copy Markdown
Author

Have refined the code to remove half on value scalar, please have a check, thank you!

@ptillet
Copy link
Copy Markdown

ptillet commented Feb 8, 2017

That looks good to me! Feel free to submit a PR in isaac's dev repository :)

@gongzg
Copy link
Copy Markdown

gongzg commented Feb 8, 2017

@ptillet will submit to your repo soon. @listenlink Thanks for your contribution.

@gongzg gongzg merged commit e54662b into intel:fp16 Feb 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants