Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LUT6CY Cell creation] concurrent.ExecutionException in ParallelismTools.java at writeCheckpoint #548

Closed
nqdtan opened this issue Sep 30, 2022 · 1 comment

Comments

@nqdtan
Copy link

nqdtan commented Sep 30, 2022

I'm currently having some issue using RapidWright v2022.1.3-beta for my project. It throws an exception at writeCheckpoint when I copied a design that utilizes LUT6CY (LUT6 with carry) cells. There seems to be some complication involved with this cell as it is broken down to two subcells: LUTCY1 and LUTCY2. I made a minimal example for reproducing the issue as follows.

public class TestLUT6CY {
  public static void main(String[] args) {
    Design d = new Design("test", "xcvc1902-vsvd1760-2MP-e-S");
    EDIFNetlist nl = d.getNetlist();
    EDIFLibrary plib = nl.getLibrary("hdi_primitives");
    EDIFCell top = d.getNetlist().getTopCell();
    EDIFCell ec0 = new EDIFCell(plib, "LUT6CY");
    EDIFCell ec1 = new EDIFCell(plib, "LUTCY1"); 
    EDIFCell ec2 = new EDIFCell(plib, "LUTCY2"); 

    EDIFCellInst eci0 = new EDIFCellInst("lut6cy_test", ec0, top);
    EDIFCellInst eci1 = new EDIFCellInst("LUTCY1_INST", ec1, ec0);
    EDIFCellInst eci2 = new EDIFCellInst("LUTCY2_INST", ec2, ec0);

    SiteInst si = new SiteInst("SLICE_X182Y139", d, SiteTypeEnum.SLICEL, d.getDevice().getSite("SLICE_X182Y139"));
    BEL bel1 = si.getSite().getBEL("B5LUT");
    BEL bel2 = si.getSite().getBEL("B6LUT");

    Cell c1 = new Cell("lut6cy_test/" + eci1.getName(), si, bel1);
    Cell c2 = new Cell("lut6cy_test/" + eci2.getName(), si, bel2);

    //c1.getEDIFCellInst();
    //c2.getEDIFCellInst();

    c1.addPinMapping("A1", "I0");
    c1.addPinMapping("A2", "I1");
    c1.addPinMapping("A3", "I2");
    c1.addPinMapping("A4", "I3");
    c1.addPinMapping("A5", "I4");
    c1.addPinMapping("O6", "O");
    c1.addPinMapping("GE", "GE");

    c2.addPinMapping("A1", "I0");
    c2.addPinMapping("A2", "I1");
    c2.addPinMapping("A3", "I2");
    c2.addPinMapping("A4", "I3");
    c2.addPinMapping("A5", "I4");
    c2.addPinMapping("O5", "O");

    d.writeCheckpoint("tmp.dcp");
  }
}

I got the following error

Exception in thread "main" java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at com.xilinx.rapidwright.util.ParallelismTools.joinFirst(ParallelismTools.java:245)
at b.b(Unknown Source)
at b.a(Unknown Source)
at com.xilinx.rapidwright.design.Design.writeCheckpoint(Unknown Source)
at com.xilinx.rapidwright.examples.TestLUT6CY.main(TestLUT6CY.java:90)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at com.xilinx.rapidwright.util.ParallelismTools.joinFirst(ParallelismTools.java:243)
... 4 more
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at com.xilinx.rapidwright.util.ParallelismTools.get(ParallelismTools.java:173)
at com.xilinx.rapidwright.util.ParallelismTools.join(ParallelismTools.java:268)
at aa.a(Unknown Source)
at b.a(Unknown Source)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at com.xilinx.rapidwright.util.ParallelismTools.get(ParallelismTools.java:171)
... 7 more
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at com.xilinx.rapidwright.util.ParallelismTools.joinFirst(ParallelismTools.java:245)
at aa.a(Unknown Source)
at aa.a(Unknown Source)
at com.xilinx.rapidwright.util.b.a(Unknown Source)
at aa.a(Unknown Source)
... 4 more
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at com.xilinx.rapidwright.util.ParallelismTools.joinFirst(ParallelismTools.java:243)
... 8 more
Caused by: java.lang.NullPointerException
at aa.a(Unknown Source)
at java.lang.Iterable.forEach(Iterable.java:75)
... 7 more

I also tried this approach

    Design d = new Design("test", "xcvc1902-vsvd1760-2MP-e-S");
    EDIFNetlist nl = d.getNetlist();
    EDIFLibrary plib = nl.getLibrary("hdi_primitives");
    EDIFCell top = d.getNetlist().getTopCell();
    EDIFCell ec0 = new EDIFCell(plib, "LUT6CY");
    EDIFCellInst eci0 = new EDIFCellInst("lut6cy_test", ec0, top);

    Cell c1 = d.createAndPlaceCell(ec0, "lut6cy_test/LUTCY1_INST", Unisim.LUTCY1,
      d.getDevice().getSite("SLICE_X182Y139"),
      d.getDevice().getSite("SLICE_X182Y139").getBEL("B5LUT"));
    Cell c2 = d.createAndPlaceCell(ec0, "lut6cy_test/LUTCY2_INST", Unisim.LUTCY2,
      d.getDevice().getSite("SLICE_X182Y139"),
      d.getDevice().getSite("SLICE_X182Y139").getBEL("B6LUT"));

but also got the same error.

However, if I uncomment these lines

    //c1.getEDIFCellInst();
    //c2.getEDIFCellInst();

The code runs successfully. This is my current workaround. It's also worth noting that I was able to make this code work correctly in v2022.1.1-beta without the workround (but need to explicitly passing eci1 and eci2 to c1 and c2 cell constructors, respectively.). It seems the latest Cell constructors do not require passing an EDIFCellInst.

@clavin-xlnx
Copy link
Member

Thanks @nqdtan for reporting this issue! I can reproduce it and it appears to be a side effect of a recent refactoring of the code where we decoupled the physical netlist from the logical netlist. The Cell object has a stored reference to the cell type (EDIFCell). In the code above, it is not populated, however, in your work-around where just getting the EDIFCellInst reference forces the field to be populated. A more direct work around could also be:

        c1.setType(ec1.getName());
        c2.setType(ec2.getName());

I'll work on a fix for the next release that will populate the field prior to be written out as a DCP so we can avoid this error.

@nqdtan nqdtan closed this as completed Sep 30, 2022
clavin-xlnx added a commit that referenced this issue Sep 30, 2022
clavin-xlnx added a commit that referenced this issue Nov 1, 2022
Signed-off-by: Chris Lavin <[email protected]>

Signed-off-by: Chris Lavin <[email protected]>
Co-authored-by: Eddie Hung <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants