Skip to content

Latest commit

 

History

History
74 lines (41 loc) · 2.67 KB

vectorized_2.md

File metadata and controls

74 lines (41 loc) · 2.67 KB
benchmark_name cpp_code accera_code
Accera_Vectorized2
src/softmax/accera_vectorized_2.cpp
src/softmax/vectorized_2.py

Vectorized Accera 2

Note

The following shows the implementation of the {{benchmark_name}}. The full source code listing of the Accera code generator can be found in {{accera_code}} :fas fa-code: and the benchmark runner is found in {{cpp_code}} :fas fa-code: .

As in the naive implementation, we first need to import the required packages:

vectorized_2.py

We then define the input size:

vectorized_2.py

Target dependent characteristics can be queried from by creating a package target.

vectorized_2.py

We define our package which will be used throughout our program.

vectorized_2.py

As done previously, the input and output arrays are defined along with the auxillary temporaries.

vectorized_2.py

The max operation schedule can be defined and vectorized.

vectorized_2.py

We define the exp nest.

vectorized_2.py

The accum operation schedule is defined, but we do not perform vectorization on it.

[!ATTENTION] The accum nest can be vectorized as shown in the vectorized reduction case study.

vectorized_2.py

We finally define the normalization nest.

vectorized_2.py

We invoke the above functions to add the to the package.

vectorized_2.py

Finally, we export the package.

vectorized_2.py

Usage

The package can then be used within our C code base. To do so, we first need to import the HAT package created:

accera_vectorized_2.cpp

We then declare our inputs and outputs:

accera_vectorized_2.cpp

We then can use the exported function within our C code:

accera_vectorized_2.cpp