Skip to content

daisukeokaoss/ToukaSpecification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Touka Specification

Specitication of Testing framework that ensure if two C language function input is same then output must be same. That is ensure functionality of two function is same.Touka means equivalent by Japanese.And this is Japanese ordinary woman name.

Motivation - To Port Intel intrinsic function to OpenPOWER

Motivation to this project is trial to port Intel intrinsic function to OpenPOWER.This is one of CPU platform dependency problem. Original document is this.

https://openpowerfoundation.org/specifications/vectorintrinsicportingguide/

Porting process described in this document uses specific wrapper structure.Like shown below.

extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__,__artificial__))
_mm_add_pd (__m128d __A, __m128d __B)
{
  return (__m128d) ((__v2df)__A + (__v2df)__B);
}

This wrapper structure substitute Intel Intrinsic function _mm_add_pd.

https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_add_pd&ig_expand=116

another example of wrapper structure of porting is like below.

extern __inline  __m128d  __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_cmpeq_sd(__m128d  __A, __m128d  __B)
{
  __v2df __a, __b, __c;
  /* PowerISA VSX does not allow partial (for just lower double)
     results. So to insure we don't generate spurious exceptions
     (from the upper double values) we splat the lower double
     before we do the operation. */
  __a = vec_splats (__A[0]);
  __b = vec_splats (__B[0]);
  __c = (__v2df) vec_cmpeq(__a, __b);
  /* Then we merge the lower double result with the original upper
     double from __A.  */
  return (__m128d) _mm_setr_pd (__c[0], __A[1]);
}

This wrapper structure substitute Intel Intrinsic function _mm_cmpeq_sd.

https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpeq_sd&ig_expand=116,917

To make wrapper structure,we have to have detail understanding of Intel x86 ISA and OpenPOWER ISA.But one question arises.

This wrapper structure is truly correct?

To make sure wrapper structure is correct.We have to make testing framework Touka. Touka input random value to __A and __B to Intel Intrinsic function and that of ported to OpenPOWER or RISC-V.And make sure return value or exception arise must be same.

The Intel Intrinsics porting Touka can use

Touka can be used for porting Intel Intrinsic that not have sideeffect.
Porting like below cannot use Touka for now.Because it has sideeffect like memory access.

/* Create a vector with element [0] as *P and the rest zero. */
extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_load_sd (double const *__P)
{
   return _mm_set_sd (*__P);
}
/* Stores the lower SPFP value. */
extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_store_ss (float *__P, __m128 __A)
{
   *__P = ((__v4sf)__A)[0];
}

Touka mascot

Touka

This is the image of mascot of Testing Framwework Touka.Imaging Japanese Kimono(Japanese traditional dress) and Japanese animal musasabi.

About

A test framework to ensure the correctness of optimizations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors