Yes exactly why I have added that piece of code there. So that every time the 
program is built, it will clear the contents of that file and then on it will 
append the ASM dump into the file.

Regards
Manasi

-----Original Message-----
From: Song, Ruiling 
Sent: Wednesday, August 12, 2015 6:27 PM
To: Luo, Xionghu; Navare, Manasi D; beignet@lists.freedesktop.org
Cc: Navare, Manasi D; Ekstrand, Laura D
Subject: RE: [Beignet] [PATCH 7/7] backend: Turn on ASM dump.

> --- a/backend/src/backend/gen_context.cpp
> +++ b/backend/src/backend/gen_context.cpp
> @@ -2299,6 +2299,14 @@ namespace gbe
>      if (OCL_OUTPUT_ASM)
>        outputAssembly(stdout, genKernel);
> 
> +    if (this->asmFileName) {
> +      FILE *asmDumpStream = fopen(this->asmFileName, "a");
> +      if (asmDumpStream) {
> +        outputAssembly(asmDumpStream, genKernel);
> +        fclose(asmDumpStream);
> +      }
> +    }
> +
>      return true;
>    }
> 
> diff --git a/backend/src/backend/program.cpp 
> b/backend/src/backend/program.cpp index 6f64413..6d539a9 100644
> --- a/backend/src/backend/program.cpp
> +++ b/backend/src/backend/program.cpp
> @@ -840,6 +840,9 @@ namespace gbe {
>        }
>        #endif
> 
> +      FILE *asmDumpStream = fopen(dumpASMFileName.c_str(), "w");
> +      if (asmDumpStream)
> +        fclose(asmDumpStream);
> >>>>  is this piece of code useless?
This would clear the content in the dumpASMFileName.
As later " FILE *asmDumpStream = fopen(this->asmFileName, "a");" would append 
the cl kernel asm to the file one by one. Clearing is needed.

>        p = gbe_program_new_from_llvm(deviceID, NULL, out_module, 
> llvm_ctx, dumpASMFileName.c_str(), stringSize,
>                                      err, errSize, optLevel);
>        if (err != NULL)
> --
> 1.9.1
> 
> _______________________________________________
> Beignet mailing list
> Beignet@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
_______________________________________________
Beignet mailing list
Beignet@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to