Skip to content

Implementing Relu in ARIES - unsupported operators max(), comparators (>, <, <=, >=) #108

@adhowe3

Description

@adhowe3

I am working on implementing a full Res-Net model using ARIES. So far I have a convolutional layer, bias addition, and batch normalization layers. It has been tricky, but I have been able to make it work all in a single kernel.

I cannot implement a ReLU (Rectified Linear Unit) function using ARIES, because there is not support for a max() function or >. This is a simple function that returns 0 for negative inputs and the original value for positive inputs. ReLU is usually implemented with one of the following:

return max(x, 0)
return x * (x > 0)

It looks to me like the only current operations that generate MLIR from ARIES python are *, /, +, - as seen in aries_ir_builder.py

It looks like in the Aries/lib emitter files there is support for a max() function and many other operations not yet supported on the frontend.

I was able to modify the generated AIE code to produce the results of a max() function. It was rather simple, but doing it by hand is not ideal for large projects:

v51 = fpmac(v51, v52, 0, 0x76543210, v50, 0, 0x76543210);  // previous operation that I want to pass through ReLU
aie::vector<float,8> relu = max(v51, v17);  //  ReLU operation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions