Hi, I would like to know how the pin coordinates are extracted using dreamplace?
Thanks.
Hi, you can read the DEF into DREAMPlace, and call the pinpos operator to get a tensor of pin positions. You can read DREAMPlace's HPWL operator to see how its inputs are constructed (their input contains the pin coordinate tensor).
Originally posted by @gzz2000 in #8 (comment)
Hi,
I previously posted a related inquiry in another thread, but since that thread has been marked as completed, I believe it would be better to post this as a new issue.
As stated in the title, I’m seeing discrepancies in pin locations when using the pin_pos operation mentioned in that issue. I retrieved the pin locations for comparison, but they don’t exactly match the locations given by the nf[2:5] dump. (For reference, I used the “spm” design for testing.)
Additionally, I reviewed the description of nf[2:5] in the repository. The pin order doesn’t appear to follow the expected top/left/right/bottom layout of the die area. It seems that nf[2] + nf[5] and nf[3] + nf[4] do not match the die area height and width, respectively.
Could you please clarify this discrepancy?
The following is the minimum code to reproduce.
importsysimportosimportlogging# for consistency between python2 and python3root_dir=os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ifroot_dirnotinsys.path:
sys.path.append(root_dir)
importnumpyasnpimporttorchimportPlaceDBimportParamsfromdreamplace.ops.pin_pos.pin_posimportPinPosFunction, PinPosSegmentFunctionfromdreamplace.ops.hpwl.hpwlimportHPWLFunction, HPWLAtomicFunctionfromdreamplace.ops.pin_pos.pin_posimportPinPosfromdreamplace.ops.hpwl.hpwlimportHPWLif__name__=='__main__':
np.set_printoptions(threshold=np.inf, suppress=True)
params=Params.Params()
params.load(sys.argv[1]) # only read the DEF/LEF file in this json filelogging.info("parameters = %s"% (params)) placedb=PlaceDB.PlaceDB()
placedb(params)
pin_offset_x=torch.from_numpy(placedb.pin_offset_x).to(torch.float).cuda()
pin_offset_y=torch.from_numpy(placedb.pin_offset_y).to(torch.float).cuda()
pin2node_map=torch.from_numpy(placedb.pin2node_map).to(torch.long).cuda()
flat_node2pin_map=torch.from_numpy(placedb.flat_node2pin_map).to(torch.int).cuda()
flat_node2pin_start_map=torch.from_numpy(placedb.flat_node2pin_start_map).to(torch.int).cuda()
pin_pos_instance=PinPos(
pin_offset_x=pin_offset_x,
pin_offset_y=pin_offset_y,
pin2node_map=pin2node_map,
flat_node2pin_map=flat_node2pin_map,
flat_node2pin_start_map=flat_node2pin_start_map,
num_physical_nodes=placedb.num_physical_nodes,
)
pin_pos_instance=pin_pos_instance.cuda()
pos=torch.cat([torch.from_numpy(placedb.node_x).to(torch.float), torch.from_numpy(placedb.node_y).to(torch.float)]).cuda()
pin_pos=pin_pos_instance(pos)
# only use for checking the pin locationspin_pos=np.array(pin_pos.cpu())
pin_x=pin_pos[:placedb.num_pins]
pin_y=pin_pos[placedb.num_pins:]
pin_pos=np.stack((pin_x, pin_y), axis=1)
left=placedb.xlright=placedb.xhbottom=placedb.yltop=placedb.yhrelative_distances=np.array([
pin_pos[:, 0] -left, # distance_to_leftright-pin_pos[:, 0], # distance_to_rightpin_pos[:, 1] -bottom, # distance_to_bottomtop-pin_pos[:, 1], # distance_to_top
]).Trelative_distances=np.array(relative_distances)
withopen('pins', mode='w+', encoding='UTF-8') asfile:
file.write(str(relative_distances))
logging.info('write successfully')Thanks in advance for your help.
Hi,
I previously posted a related inquiry in another thread, but since that thread has been marked as completed, I believe it would be better to post this as a new issue.
As stated in the title, I’m seeing discrepancies in pin locations when using the pin_pos operation mentioned in that issue. I retrieved the pin locations for comparison, but they don’t exactly match the locations given by the nf[2:5] dump. (For reference, I used the “spm” design for testing.)
Additionally, I reviewed the description of nf[2:5] in the repository. The pin order doesn’t appear to follow the expected top/left/right/bottom layout of the die area. It seems that nf[2] + nf[5] and nf[3] + nf[4] do not match the die area height and width, respectively.
Could you please clarify this discrepancy?
The following is the minimum code to reproduce.
Thanks in advance for your help.