MozTW 討論區

各項 Mozilla 相關軟體與技術討論
現在的時間是 2024-04-27, 01:35

所有顯示的時間為 UTC + 8 小時





發表新文章 回覆主題  [ 9 篇文章 ] 
發表人 內容
文章發表於 : 2010-01-27, 17:41 
離線

註冊時間: 2010-01-27, 15:55
文章: 4
PGO编译成功,详情请去我的博客观赏。

http://hi.baidu.com/coolypf

Linux下用icc替换gcc编译Firefox比较容易,Windows下用icl替换cl则很困难。

下面的程序可以帮助骗过configure脚本,将编译所得程序重命名为cl,放入msys/bin目录中。

make -f client.mk build启动编译,遇到错误停止时,configure步骤已经过去,

可以用make -f client.mk build CC=icl CXX=icl继续编译。

目前测试,可以顺利完成整个编译过程(有些代码要稍加修改)。

代碼:
/*********************************
 * ICC wrapper for Mozilla Build *
 * by coolypf           20100127 *
 *********************************/

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <string>

using std::string;

char cl[]="c:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\cl.exe";
char icl[]="c:\\Program Files (x86)\\Intel\\Compiler\\11.1\\051\\Bin\\ia32\\icl.exe";
char clflags[]="/O2";
char iclerr[]=": error: ";
PROCESS_INFORMATION pi;

HANDLE Exec(const char *cmd)
{
   SECURITY_ATTRIBUTES sa;
   HANDLE hRead,hWrite;
   sa.nLength = sizeof(SECURITY_ATTRIBUTES);
   sa.lpSecurityDescriptor = NULL;
   sa.bInheritHandle = TRUE;
   if (!CreatePipe(&hRead,&hWrite,&sa,0))
   {
      printf("Error On CreatePipe()");
      exit(-1);
   }
   STARTUPINFOA si;
   si.cb = sizeof(STARTUPINFO);
   GetStartupInfoA(&si);
   si.hStdError = hWrite;
   si.hStdOutput = hWrite;
   si.wShowWindow = SW_HIDE;
   si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
   if (!CreateProcessA(NULL,_strdup(cmd),NULL,NULL,TRUE,NULL,NULL,NULL,&si,&pi))
   {
      printf("Error on CreateProcess()");
      exit(-1);
   }
   CloseHandle(hWrite);
   return hRead;
}

int main(int argc, char **argv)
{
   string arg;
   for(int i=1; i<argc; ++i)
   {
      arg.append(" ");
      arg.append(argv[i]);
   }
   string clcmd=cl+string(" ")+clflags+" "+arg;
   string iclcmd=icl+string(" ")+arg;
   char buf[10241];
   unsigned long count;
   HANDLE h;
   h=Exec(clcmd.c_str());
   while(ReadFile(h, buf, 10240, &count, 0))
   {
      buf[count]=0;
      printf("%s", buf);
   }
   WaitForSingleObject(pi.hProcess, INFINITE);
   unsigned long e1;
   if(!GetExitCodeProcess(pi.hProcess, &e1)) e1=0;
   h=Exec(iclcmd.c_str());
   bool r=false;
   while(ReadFile(h, buf, 10240, &count, 0))
   {
      buf[count]=0;
      if(strstr(buf, iclerr))
      {
         r=true;
         break;
      }
   }
   WaitForSingleObject(pi.hProcess, INFINITE);
   unsigned long e2;
   if(!GetExitCodeProcess(pi.hProcess, &e2)) e2=0;
   if(r) Exec(clcmd.c_str());
   if(e1==0 || e2==0) return 0;
   return e1;
}


最後由 coolypf 於 2010-02-01, 16:39 編輯,總共編輯了 1 次。

回頂端
Opera/9.80 (Windows NT 6.1; U; Cabbage Edition; zh-cn) Presto/2.2.15 Version/10.10
 個人資料  
引用回覆  
文章發表於 : 2010-01-28, 09:22 
離線
[MozTW 版主群]
頭像

註冊時間: 2002-12-03, 21:00
文章: 744
來自: 地球
coolypf 寫:
目前測試,可以順利完成整個編譯過程(有些代碼要稍加修改),但ICC啟用PGO選項後編譯出來的程序沒法運行。

跟我當初測的結果差不多,不過 Intel C++ 沒了 PGO 那還不如用 VC++ 就好 :?

_________________
想讓 Internet Explorer 當掉嗎?

「方法一」 - 被 google 檔掉的樣子,開不起來

「方法二」


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20100104 SeaMonkey/2.0.2
 個人資料  
引用回覆  
文章發表於 : 2010-01-28, 11:58 
離線

註冊時間: 2010-01-27, 15:55
文章: 4
s793016 寫:
coolypf 寫:
目前測試,可以順利完成整個編譯過程(有些代碼要稍加修改),但ICC啟用PGO選項後編譯出來的程序沒法運行。

跟我當初測的結果差不多,不過 Intel C++ 沒了 PGO 那還不如用 VC++ 就好 :?

确实,ICC用-O3 -QxHost选项编译出来的程序比VC的PGO要慢一些。

目前我正在尝试:
"-O3 -QxHost -Qparallel -Qipo-separate -Qprof-gen -Qprof-dird:/temp/ffprof"


回頂端
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.308.0 Safari/532.9
 個人資料  
引用回覆  
文章發表於 : 2010-01-28, 23:31 
離線
[MozTW 版主群]
頭像

註冊時間: 2002-12-03, 21:00
文章: 744
來自: 地球
您加油,我因工作加重,且 Seamonkey 2.0 出了,短時間內我已經不太想再自已編了。

當然,可以的話,也請最終整理一下編譯的作法並發篇簡短的教學吧,因中文的世界這種文真的太少了,少到幾乎沒有。

當年寫的東西,獻醜一下:
VS2005 編譯 Gecko 1.8
VS2008 編譯 Gecko 1.8

這個是別人寫的:
Win32 MingW 編譯 Firefox

_________________
想讓 Internet Explorer 當掉嗎?

「方法一」 - 被 google 檔掉的樣子,開不起來

「方法二」


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20100104 SeaMonkey/2.0.2
 個人資料  
引用回覆  
文章發表於 : 2010-05-01, 00:15 
離線
[MozTW 版主群]
頭像

註冊時間: 2002-12-03, 21:00
文章: 744
來自: 地球
目前測試編 firefox 3.6.3 intel c++ v11 無 pgo 版已編譯成功,待全部研究完後再寫專文。

ps: 用的不是樓主的方法。

_________________
想讓 Internet Explorer 當掉嗎?

「方法一」 - 被 google 檔掉的樣子,開不起來

「方法二」


回頂端
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.9) Gecko/20100417 SeaMonkey/2.0.4 (s793016/SSE2)
 個人資料  
引用回覆  
文章發表於 : 2010-05-06, 15:25 
離線
[MozTW 版主群]

註冊時間: 2005-04-16, 09:20
文章: 1492
我抓了樓主的來試用。不過一直出現錯誤…
找了libmmd.dll來也一樣動不了。

我的電腦是 Intel Core 2 Duo T5450 處理器,
作業系統是Windows Vista Home Premium x86 w/SP2繁體中文版

_________________
我的網誌…
Atenza Cafe


回頂端
Mozilla/5.0 (Windows; U; Windows NT 6.0; zh-TW; rv:1.9.1.9) Gecko/20100417 Lightning/1.0b1 SeaMonkey/2.0.4 (s793016/SSE2)
 個人資料  
引用回覆  
文章發表於 : 2010-05-26, 11:11 
離線
頭像

註冊時間: 2008-06-23, 13:33
文章: 23
來自: 鋼鐵之城
很好奇, 用icc 11 pgo編出來的 Firefox 是否會快過用 GCC 4.5 pgo編的
根據這裡, 在Linux下這兩個本版的效能差不多


回頂端
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.4) Gecko/20100422 Firefox/3.6.4 (tete009 SSE2 PGO)
 個人資料  
引用回覆  
文章發表於 : 2010-05-26, 23:16 
離線
[MozTW 版主群]
頭像

註冊時間: 2002-12-03, 21:00
文章: 744
來自: 地球
cecilyen 寫:
很好奇, 用icc 11 pgo編出來的 Firefox 是否會快過用 GCC 4.5 pgo編的
根據這裡, 在Linux下這兩個本版的效能差不多

目前 google 看得到的 icl 編譯 firefox 都沒有 pgo,有 pgo 的只有樓主的版本。

我目前自己編是無法完成 icl pgo。

而我測試過自編的 icl firefox 無 pgo 的版本是比官版 pgo 來得慢。

_________________
想讓 Internet Explorer 當掉嗎?

「方法一」 - 被 google 檔掉的樣子,開不起來

「方法二」


回頂端
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.9) Gecko/20100417 SeaMonkey/2.0.4 (s793016/SSE2)
 個人資料  
引用回覆  
文章發表於 : 2010-05-30, 23:15 
離線
[MozTW 版主群]
頭像

註冊時間: 2002-12-03, 21:00
文章: 744
來自: 地球
這邊提供無 PGO 的版本供測試:載點

使用的最佳化參數是這樣:
-fast -QaxAVX,SSE4.2,SSE4.1,SSE3_ATOM,SSSE3,SSE3,SSE2 -QxSSE2 -W0 -Qparallel -Qmultibyte-chars -GLT -GS- -fp:fast=2 -MP:2 -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -wd4624 -wd4952 -Quse-intel-optimized-headers -Qopt-multi-version-aggressive -Qopt-prefetch:4 -Qipo-jobs:2 -Qopt-mem-bandwidth2

想自己編的人,下載附件的 patch 回去打上就可以編了。不過 pgo 編不過哦,會出現這個問題。目前無解:
引言回覆:
xilib -NOLOGO -OUT:"migration_s.lib" nsProfileMigrator.obj nsBrowserProfileMigratorUtils.obj nsNetscapeProfileMigratorBase.obj nsSeamonkeyProfileMigrator.obj nsPhoenixProfileMigrator.obj nsDogbertProfileMigrator.obj nsOperaProfileMigrator.obj nsIEProfileMigrator.obj
(0): internal error: 0_0

xilib: error #10014: problem during multi-file optimization compilation (code 4)
xilib: error #10014: problem during multi-file optimization compilation (code 4)
make[7]: *** [migration_s.lib] Error 1
make[7]: Leaving directory `/d/mozilla/comm-1.9.1/obj/browser/components/migration/src'
make[6]: *** [libs] Error 2
make[6]: Leaving directory `/d/mozilla/comm-1.9.1/obj/browser/components/migration'
make[5]: *** [libs] Error 2
make[5]: Leaving directory `/d/mozilla/comm-1.9.1/obj/browser/components'
make[4]: *** [libs] Error 2
make[4]: Leaving directory `/d/mozilla/comm-1.9.1/obj/browser'
make[3]: *** [libs_tier_app] Error 2
make[3]: Leaving directory `/d/mozilla/comm-1.9.1/obj'
make[2]: *** [tier_app] Error 2
make[2]: Leaving directory `/d/mozilla/comm-1.9.1/obj'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/d/mozilla/comm-1.9.1/obj'
make: *** [build] Error 2


附加檔案:
檔案註釋: fx363-icl11.diff
fx363-icl11.rar [1.85 KiB]
被下載 394 次

_________________
想讓 Internet Explorer 當掉嗎?

「方法一」 - 被 google 檔掉的樣子,開不起來

「方法二」
回頂端
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.9) Gecko/20100417 SeaMonkey/2.0.4 (s793016/SSE2)
 個人資料  
引用回覆  
顯示文章 :  排序  
發表新文章 回覆主題  [ 9 篇文章 ] 

所有顯示的時間為 UTC + 8 小時


誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 14 位訪客


不能 在這個版面發表主題
不能 在這個版面回覆主題
不能 在這個版面編輯您的文章
不能 在這個版面刪除您的文章
不能 在這個版面上傳附加檔案

搜尋:
前往 :  
cron
Powered by phpBB® Forum Software © phpBB Group
正體中文語系由 竹貓星球 維護製作
© moztw.org, Mozilla Foundation
MozTW,Mozilla 台灣社群