[Beignet] [PATCH 7/7] backend: Turn on ASM dump.

Song, Ruiling ruiling.song at intel.com
Tue Aug 11 07:48:28 PDT 2015



> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> Laura Ekstrand
> Sent: Tuesday, July 28, 2015 1:25 AM
> To: beignet at lists.freedesktop.org
> Cc: Ekstrand, Laura D
> Subject: [Beignet] [PATCH 7/7] backend: Turn on ASM dump.
> 
> Open the file specified for the ASM dump and write the assembly to it.
> ---
>  backend/src/backend/gen_context.cpp | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/backend/src/backend/gen_context.cpp
> b/backend/src/backend/gen_context.cpp
> index 446b693..56946a3 100644
> --- a/backend/src/backend/gen_context.cpp
> +++ b/backend/src/backend/gen_context.cpp
> @@ -2295,6 +2295,14 @@ namespace gbe
>      if (OCL_OUTPUT_ASM)
>        outputAssembly(stdout, genKernel);
> 
> +    if (this->asmFileName) {
> +      FILE *asmDumpStream = fopen(this->asmFileName, "w");
A program may contains several cl kernels. Opening with "w" would make the final asm file only contain the asm of the last one.
So, you may change to use "a", which would append the several cl kernels together.
But to be user-friendly, you may need to clear the file before outputting any assembly to the file in-case user run the program again and again.

See Program::buildFromUnit(), it will call compileKernel for all the cl kernel inside the cl program.
And the patch have little conflict with master version, need to rebase and add the sign-off-by
Other patch in the patchset just seem good.

Thanks!
Ruiling
> +      if (asmDumpStream) {
> +        outputAssembly(asmDumpStream, genKernel);
> +        fclose(asmDumpStream);
> +      }
> +    }
> +
>      return true;
>    }
> 
> --
> 2.1.0
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list