r264021 - [Perf-training] Fixing an issue with multi-threading PGO generation

Chris Bieneman via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 22 09:39:01 PDT 2016


I totally didn’t know python had a portable way to do that!

Updated in r264064.

Thanks!
-Chris

> On Mar 22, 2016, at 9:26 AM, Vedant Kumar <vsk at apple.com> wrote:
> 
> I think setting `cc1_env["LLVM_PROFILE_FILE"] = os.devnull` would be simpler.
> 
> vedant
> 
>> On Mar 21, 2016, at 7:55 PM, Chris Bieneman via cfe-commits <cfe-commits at lists.llvm.org> wrote:
>> 
>> Author: cbieneman
>> Date: Mon Mar 21 21:55:40 2016
>> New Revision: 264021
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=264021&view=rev
>> Log:
>> [Perf-training] Fixing an issue with multi-threading PGO generation
>> 
>> When LIT parallelizes the profraw file generation we need to generate unique temp filenames then clean them up after the driver executes.
>> 
>> Modified:
>>   cfe/trunk/utils/perf-training/perf-helper.py
>> 
>> Modified: cfe/trunk/utils/perf-training/perf-helper.py
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/perf-training/perf-helper.py?rev=264021&r1=264020&r2=264021&view=diff
>> ==============================================================================
>> --- cfe/trunk/utils/perf-training/perf-helper.py (original)
>> +++ cfe/trunk/utils/perf-training/perf-helper.py Mon Mar 21 21:55:40 2016
>> @@ -16,6 +16,7 @@ import argparse
>> import time
>> import bisect
>> import shlex
>> +import tempfile
>> 
>> test_env = { 'PATH'    : os.environ['PATH'] }
>> 
>> @@ -149,10 +150,12 @@ def cc1(args):
>> 
>>  # clear the profile file env, so that we don't generate profdata
>>  # when capturing the cc1 command
>> +  handle, profraw_file = tempfile.mkstemp()
>> +  os.close(handle)
>>  cc1_env = test_env
>> -  cc1_env["LLVM_PROFILE_FILE"] = "driver.prfraw"
>> +  cc1_env["LLVM_PROFILE_FILE"] = profraw_file
>>  cc1_cmd = get_cc1_command_for_args(cmd, cc1_env)
>> -  os.remove("driver.prfraw")
>> +  os.remove(profraw_file)
>> 
>>  subprocess.check_call(cc1_cmd)
>>  return 0;
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> 



More information about the cfe-commits mailing list