最佳化計算你好,
我有一個 jsl 程式碼來計算離晶圓中心的徑向距離。資料表 XYCoord 有 X、Y 和晶圓 ID 欄位。
它計算距離並在表格中添加距離中心 1mm 的距離列
目前,對於 656k 行,完成該過程需要 > 3-4 分鐘,這太長了。
有沒有辦法優化並使其更快?
自動化和腳本編寫回覆:優化計算我嘗試根據您提供的數據執行您的腳本,但失敗了。我嘗試修正的第一項是腳本中各行上的雜散“=”。
第 23、25、106、139 和 152 行都有一個“=”
接下來,錯誤訊息轉向似乎是從先前的執行中清除的列,但在您提供的表中它們不存在,因此腳本失敗。
RadiusDieCenter、xcentering、ycentering、圓角半徑 1mm、圓角半徑 0.51mm
我在有問題的行周圍添加了 Try()
第 21 行的 X 座標列被引用,但資料表中不存在
我將其更改為 U1_x 假設這是運行的 x 座標列
然後程式碼運行了 2 分 12 秒,沒有錯誤,但我不知道結果是否是正確的結果。 Xcentering 和 Ycentering 列均為零。這是我們所期望的嗎?

回覆:優化計算嗨吉姆,
是的,這是正確的。您可以透過繪製 X 和 Y 圖表並反白顯示 1mm col 值來驗證結果。想知道是否可以進一步優化。我已更正上面附加的 jsl 檔案中的錯誤
回覆:優化計算嗨@Jackie_ ,
該腳本在每個循環上重新計算了幾個 Col 值。請嘗試這個:
結束 - 開始 = 6.15000000002328;
Names Default To Here( 1 );
start = Tick Seconds();
dt = Current Data Table();
dt << Clear Column Selection;
Try( dt << delete columns( RadiusDieCenter ) );
Try(
dt << delete columns( RadiusDieEdge );
dt << delete columns( Xcentering );
dt << delete columns( Ycentering );
dt << delete columns( Radius Rounded 1mm );
dt << delete columns( Radius Rounded 0.51mm );
dt << delete columns( Radius Rounded 1mm );
);
z5Identifier = 1;
Xaxis = "U1_x";
Yaxis = "U1_y";
DieXSize = 1.160; //in mm
DieYSize = 0.810;//in mm
WaferColumns = N Items( Associative Array( As Column( Xaxis ) ) << Get Keys );
columnsRad = ((WaferColumns * DieXSize) / 2);
MaxRadiusEntry = 147;
dt << Set Table Variable( "DieXSize", DieXSize );
dt << Set Table Variable( "DieYSize", DieYSize );
dt << Set Table Variable( "MaxRadius", MaxRadiusEntry );
dt << begin data update;
xcoordmax = Col Maximum( As Column( Xaxis ) );
xcoordmin = Col Minimum( As Column( Xaxis ) );
ycoordmax = Col Maximum( As Column( Yaxis ) );
ycoordmin = Col Minimum( As Column( Yaxis ) );
New Column( "RadiusDieCenter",
Formula( Sqrt( (Abs( (As Column( Xaxis ) - CenterXCoord) * DieXSize )) ^ 2 + Abs( ((As Column( Yaxis ) - CenterYCoord) * DieYSize) ) ^ 2 ) )
);
New Column( "RadiusDieEdge",
Formula(
Sqrt(
(Abs( (As Column( Xaxis ) - CenterXCoord) * DieXSize ) + Abs( DieXSize / 2 )) ^ 2 + (Abs(
(As Column( Yaxis ) - CenterYCoord) * DieYSize
) + Abs( DieYSize / 2 )) ^ 2
)
)
);
xcoordrange = xcoordmax - xcoordmin;
ycoordrange = ycoordmax - ycoordmin;
dt << Set Table Variable( "CenterXCoord", xcoordmin + xcoordrange / 4 );
dt << Set Table Variable( "CenterYCoord", ycoordmin + ycoordrange / 4 );
dt << Run Formulas;
xiter = Ceiling( Log( xcoordrange * 1600, 1.8 ) );
yiter = Ceiling( Log( ycoordrange * 1600, 1.8 ) );
maxiter = Max( xiter, yiter );
New Column( "Xcentering",
Numeric,
Formula(
If( As Column( Xaxis ) > :CenterXCoord & :RadiusDieEdge > :MaxRadius,
1,
If( As Column( Xaxis ) < :CenterXCoord & :RadiusDieEdge > :MaxRadius,
-1,
0
)
)
)
);
New Column( "Ycentering",
Numeric,
Formula(
If( As Column( Yaxis ) > :CenterYCoord & :RadiusDieEdge > :MaxRadius,
1,
If( As Column( Yaxis ) < :CenterYCoord & :RadiusDieEdge > :MaxRadius,
-1,
0
)
)
)
);
dt << end data update;
sum_x_centering = Col Sum( :Xcentering );
min_x_centering = Col Min( :Xcentering );
max_x_centering = Col Max( :Xcentering );
sum_y_centering = Col Sum( :Ycentering );
min_y_centering = Col Min( :Ycentering );
max_y_centering = Col Max( :Ycentering );
For( i = 1, i <= maxiter, i++,
centerx = Num( dt << Get Table Variable( "CenterXCoord" ) );
centery = Num( dt << Get Table Variable( "CenterYCoord" ) );
xcoordrange = xcoordrange / 1.8;
ycoordrange = ycoordrange / 1.8;
dt << Run Formulas;
If( sum_x_centering > 0,
dt << Set Table Variable( "CenterXCoord", centerx + xcoordrange );
centerx = centerx + xcoordrange;
,
If( sum_x_centering < 0,
dt << Set Table Variable( "CenterXCoord", centerx - xcoordrange );
centerx = centerx + xcoordrange;
)
);
If( sum_y_centering > 0,
dt << Set Table Variable( "CenterYCoord", centery + ycoordrange );
centery = centery + ycoordrange;
,
If( sum_y_centering < 0,
dt << Set Table Variable( "CenterYCoord", centery - ycoordrange );
centery = centery + ycoordrange;
)
);
If( max_x_centering < 1 & min_x_centering > -1 & max_y_centering < 1 & min_y_centering > -1,
OldRadius = dt << Get Table Variable( "MaxRadius" );
NewRadius = Num( OldRadius ) - 0.01;
dt << Set Table Variable( "MaxRadius", Char( NewRadius ) );
xcoordrange = xcoordmax - xcoordmin;
ycoordrange = ycoordmax - ycoordmin;
dt << Run Formulas;
i = 1;
);
dt << Run Formulas;
);
New Column( "Radius Rounded 1mm", Numeric, "Continuous", Format( "Best", 12 ), Formula( Ceiling( :RadiusDieEdge ) ) );
end = Tick Seconds();
Show( end - start );
回覆:優化計算我認為可以用來加快處理速度的是重新編碼腳本並刪除表腳本作為中間儲存的使用。
我進行了一個小測試來檢查使用表變數與使用記憶體變數的效率,在我的測試中,表變數方法使用了 26 秒來處理,而記憶體變數方法花了 0.5 秒。
考慮使用全域記憶體變數或建立名稱空間變數來保存臨時計算。如果您希望表變數具有最終值,則只需在腳本末尾設定一次即可。
回覆:優化計算那太棒了。你介意分享吉姆嗎?
回覆:優化計算結果不正確@robot

應該和我的腳本一起

回覆:優化計算這是我使用的2個測試腳本
names default to here(1);
dt = new table("example");
dt << new table variable("test",42);
start = tick seconds();
dt=current data table();
for(i=1,i<=1000000,i++,
x=num(dt<<GET table="" variable=""></GET>
<CODE class=" language-jsl">names default to here(1);
If(!isnamespace(t), t = new namespace("temp"));
start = tick seconds();
dt=current data table();
t:x=1;
for(i=1,i<=1000000,i++,
y = t:x;
y=y+1;
t:x=y;
);
end = tick seconds();
show(end -start);回覆:優化計算快速瀏覽一下腳本,很可能有很多不同的優化可以完成,但我對你正在計算的內容有點困惑。
- 如何根據這些數據確定晶圓的中心?
- 從晶圓中心到哪個半徑的距離?
- 整個模具必須屬於半徑還是僅屬於中心?
回覆:優化計算做出了很多假設
/*""" Optimize the computation
author: jthi
date: 2024-09-05
url: https://community.jmp.com/t5/Discussions/Optimize-the-computation/m-p/795219
keywords/tags: [semiconductor,wafer,distance,matrix,die]
Description: Calculate distance from center of wafer (coordinates) to corner of die
"""*/
Names Default To Here(1);
dt_temp = Open("$DOWNLOADS/XYCoord.jmp");
die_width = 1.160;
die_height = 0.810;
dt = dt_temp << Summary(
Group(:U1_x, :U1_y),
Freq("None"),
Weight("None"),
Link to original data table(0),
output table name("Coords")
);
dt << Delete Scripts(dt << Get Table Script Names);
// Use Update to join the distances back using U1_x and U1_y as linking ids
Close(dt_temp, no save); // Close as not needed for this demo
m_x = Column(dt, "U1_x") << get values;
m_y = Column(dt, "U1_y") << get values;
// Origo to 0, 0 and coordinates to "real" measures
// This most likely will require some adjustments but you know your data so you should be able to modify this as needed
xcoords = (m_x - Max(m_x) / 2) * die_width + die_width / 2;
ycoords = (m_y - Max(m_y) / 2) * die_height + die_height / 2;
// Distance from center to each of the corners of rectangle
// assumes that the "coordinate" is at the center of die
top_left = xcoords - die_width / 2 || ycoords + die_height / 2;
bottom_left = xcoords - die_width / 2 || ycoords - die_height / 2;
top_right = xcoords + die_width / 2 || ycoords + die_height / 2;
bottom_right = xcoords + die_width / 2 || ycoords - die_height / 2;
d_tl = Sqrt(Distance(top_left, [0 0]));
d_bl = Sqrt(Distance(bottom_left, [0 0]));
d_tr = Sqrt(Distance(top_right, [0 0]));
d_br = Sqrt(Distance(bottom_right, [0 0]));
// Assume that furthest part of die is the determining factor for distance
die_distance_to_center = Round(V Max((d_tl || d_bl || d_tr || d_br)`));
dt << New Column("D", Numeric, Ordinal, Values(die_distance_to_center));
nw = New Window("Demo",
H List Box(
dt << Data Filter(
Add Filter(columns(:D), Display(:D, N Items(15), Find(Set Text(""))))
),
gb = dt << Graph Builder(
Size(528, 463),
Show Control Panel(0),
Lock Scales(1),
Variables(X(:U1_x), Y(:U1_y)),
Elements(Points(X, Y, Legend(4))),
SendToReport(
Dispatch({}, "U1_x", ScaleBox,
{Format("Fixed Dec", 12, 0), Min(-2.87573722663528), Max(261.04),
Inc(50), Minor Ticks(1)}
),
Dispatch({}, "U1_y", ScaleBox,
{Format("Fixed Dec", 12, 0), Min(-3.300675), Max(380), Inc(100),
Minor Ticks(4)}
)
)
)
)
);
Write();


回覆:優化計算@jthi
1.透過計算X、Y座標的範圍(即最大值減去最小值)來決定晶圓的中心。該中心的初始估計計算如下:
- CenterXCoord = xcoordmin + xcoordrange / 4
- CenterYCoord = ycoordmin + ycoordrange / 4
然後,程式碼在每次迭代中透過將座標範圍除以 1.8 來迭代調整這些座標,直到滿足 X 和 Y 居中條件。當兩個軸的居中公式找到最終的中心
2. 半徑計算為從晶圓中心到晶片“RadiusDieCenter”的入口或晶片“RadiusDieEdge”的邊緣
3. 只有模具的中心需要位於計算的半徑內。半徑計算重點在於從晶圓中心到每個晶片中心的距離。