_mm256_round_ps operation
Andrii Lomakin
andrii0lomakin at gmail.com
Wed May 29 07:58:00 UTC 2024
Hi Paul.
Thank you for getting back to me.
Let me explain why I need it. You may find such a demand reasonable.
I need it to calculate SoftMax in a two-phase fashion.
Straightforward calculation of e^x leads to the overflow on a short-range
interval, so a typical trip is to normalize exponential part by finding the
maximum exponent value and subtracting the maximum value from the exponent,
leading to the three-phase calculation of SoftMax.
However, it is possible to limit the exponent of the e^x to a relatively
short range using this formula.
[image: New Bitmap image.bmp]
That leads to the two-phase algorithm for the calculation of SoftMax.
I suppose that other ML guys will find it helpful to use round vector
operation in such cases.
I have implemented it using sign extraction using shit and conversation
operations, but I would prefer to use intrinsics instead.
On Wed, May 29, 2024 at 1:20 AM Paul Sandoz <paul.sandoz at oracle.com> wrote:
> Hi Andrii,
>
> You were looking in the right place, and you could not find it because it
> does not exist :-)
>
> So far we have not encountered any demand, but it should be possible to
> add such support as long as we can be compatible with the behavior of
> Math.round. (We could also consider including compatible unary vector
> operations for Math.ciel and Math.floor).
>
> Paul.
>
> > On May 25, 2024, at 11:59 PM, Andrii Lomakin <andrii0lomakin at gmail.com>
> wrote:
> >
> > Hi guys.
> >
> > I suppose I missed something, but I can not find roundp operation in
> FloatVector API.
> > I have searched over usage of unary() method but again can not find it,
> though I found neg and abs.
> >
> > Could you point me in the right direction?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20240529/6244b12a/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: New Bitmap image.bmp
Type: image/bmp
Size: 55500 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20240529/6244b12a/NewBitmapimage-0001.bmp>
More information about the panama-dev
mailing list