优化计算你好,
我有一个 jsl 代码来计算从晶圆中心的径向距离。数据表 XYCoord 有 X、Y 和晶圆 ID 列。
它计算距离并将距离中心 1 毫米的距离列添加到表中
目前,有 656k 行,该过程需要 3-4 分钟才能完成,这太多了。
有没有办法可以优化并使其更快?
自动化和脚本回复:优化计算我尝试根据您提供的数据执行脚本,但失败了。我尝试更正的第一项是脚本中各行中多余的“=”。
第 23、25、106、139 和 152 行均有一个“=”
接下来,错误消息变成了看起来像是从以前的执行中清理的列,但是在您提供的表中它们不存在,因此脚本失败。
RadiusDieCenter、xcentering、ycentering、半径四舍五入 1mm、半径四舍五入 0.51mm
我在有问题的行周围添加了 Try()
第 21 行的 X Coord 列被引用,但在数据表中不存在
我将其更改为 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 秒。
考虑使用全局内存变量或创建名称空间变量来保存临时计算。如果您希望表变量最终具有最终值,则只需在脚本末尾设置一次即可。
回复:优化计算太棒了。你介意分享一下 Jim 吗?
回复:优化计算结果不正确@robot

应该和我的脚本一起

回复:优化计算以下是我使用的两个测试脚本
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 坐标的范围(即最大值减去最小值)来确定晶圆的中心。中心的初始估计值计算如下:
- 中心X坐标 = xcoordmin + xcoordrange / 4
- 中心 Y 坐标 = y 坐标最小值 + y 坐标范围 / 4
然后,代码通过在每次迭代中将坐标范围除以 1.8 来迭代调整这些坐标,直到满足 X 和 Y 居中条件。当两个轴的居中公式都满足时,就会找到最终的中心
2. 半径是从晶圆中心到芯片入口“RadiusDieCenter”或芯片边缘“RadiusDieEdge”计算得出的
3. 仅芯片中心需要位于计算半径内。半径计算侧重于从晶圆中心到每个芯片中心的距离。