Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate only one type per primitive #11

Open
RenatoUtsch opened this issue May 3, 2016 · 0 comments
Open

Generate only one type per primitive #11

RenatoUtsch opened this issue May 3, 2016 · 0 comments

Comments

@RenatoUtsch
Copy link
Member

For example, in the following code:

        $gMaxIterator2_Allocation = Allocation.createSized($mRS, Element.F32($mRS), 1);
        $kernel_ReinhardCompilerOperator.set_gMaxIterator2(max);
        $kernel_ReinhardCompilerOperator.set_gOutputMaxIterator2($gMaxIterator2_Allocation);

        $kernel_ReinhardCompilerOperator.set_gInputImageIterator2($imageOut);
        $kernel_ReinhardCompilerOperator.set_gInputXSizeIterator2($imageOut.getType().getX());
        $kernel_ReinhardCompilerOperator.set_gInputYSizeIterator2($imageOut.getType().getY());
        $kernel_ReinhardCompilerOperator.invoke_iterator2();

        float[] $maxIterator2 = new float[1];
        $gMaxIterator2_Allocation.copyTo($maxIterator2);
        return $maxIterator2[0];

The two types generated per primitive (gMax and gOutputMax for the max float) can be simplified to only one:

        $gMaxIterator2_Allocation = Allocation.createSized($mRS, Element.F32($mRS), 1);
        float[] $maxIterator2 = new float[1];
        $maxIterator2[0] = max;
        $kernel_ReinhardCompilerOperator.set_gMaxIterator2($gMaxIterator2_Allocation);

        $kernel_ReinhardCompilerOperator.set_gInputImageIterator2($imageOut);
        $kernel_ReinhardCompilerOperator.set_gInputXSizeIterator2($imageOut.getType().getX());
        $kernel_ReinhardCompilerOperator.set_gInputYSizeIterator2($imageOut.getType().getY());
        $kernel_ReinhardCompilerOperator.invoke_iterator2();

        $gMaxIterator2_Allocation.copyTo($maxIterator2);
        return $maxIterator2[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant