• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. ipcSkillProcess and results buffering

Stats

  • Replies 7
  • Subscribers 149
  • Views 322
  • Members are here 0

ipcSkillProcess and results buffering

BS202501273649
BS202501273649 7 days ago

I am using ipcSkillProcess to allow a Python program to send SKILL commands to Virtuoso and consume the results.   It all works very well - I use read on the Python side and it gets back bytes containing the result of evaluating the command sent.

In production I generally haven't seen any problems but in theory it seems I should worry about the length of the results - the read could provide a buffer's worth but there might be more to come.  The manual talks about a 4096 byte buffer but I've certainly got more than that in a single read.  But I have been able to exceed some buffer size somewhere in a testing scenario by making the result of the evaluation very long.  Then my Python program only gets the first part of the results truncated and the rest comes through in the next read.  Not sure if that is a Python or a Virtuoso buffer size.

I could fix that by forcing some delimiters into the results and in Python reading until I get the terminating delimiter but that's a bit constraining on the results format.   Or I could maybe check for the buffer being full somewhere (on the Python side or the Virtuoso side?) and giving an error or special casing it somehow.

Neither seem very attractive.  Is there a sensible standard pattern for handling this?

  • Cancel
  • Sign in to reply
Parents
  • BS202501273649
    BS202501273649 7 days ago

    Just to add a little detail - I think the size of the chunk that's read is a feature of the linux call used to read from the pipe and not a feature of Virtuoso though there could also be chunking going on on the Virtuoso side, not sure.

    The particularly annoying issue for me is that the simple and clear code mostly works fine in practice.  The problem is that it doesn't work in theory (!) - there is a potential future bug lurking when a result size exceeds the (unknown) chunk size limit.   It seems a pity to drastically complicate my code for this unlikely scenario but for safety I think I need to.  Or at least document the limit.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Andrew Beckett
    Andrew Beckett 7 days ago in reply to BS202501273649
    BS202501273649 said:
    I think the size of the chunk that's read is a feature of the linux call used to read from the pipe

    It's not quite that simple, but either way it's an implementation detail because of not knowing how much is coming from the interface in advance.

    ipcReadProcess does document the 4096 byte buffer, but from some experiments I also see it double that sometimes. I can see in the implementation there are some buffers which are double (excluding termination).

    As Aurel said, the standard way is to put the SKILL into a file, and then have the python program send the SKILL to load the file. That avoids the issue (I think Aurel's answer was for the direction you're using).

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett 7 days ago in reply to BS202501273649
    BS202501273649 said:
    I think the size of the chunk that's read is a feature of the linux call used to read from the pipe

    It's not quite that simple, but either way it's an implementation detail because of not knowing how much is coming from the interface in advance.

    ipcReadProcess does document the 4096 byte buffer, but from some experiments I also see it double that sometimes. I can see in the implementation there are some buffers which are double (excluding termination).

    As Aurel said, the standard way is to put the SKILL into a file, and then have the python program send the SKILL to load the file. That avoids the issue (I think Aurel's answer was for the direction you're using).

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • BS202501273649
    BS202501273649 6 days ago in reply to Andrew Beckett

    I've changed the read code so it carries on reading until the bytes represent a complete S expression.  That works in practice and (I think) in theory because the result of evaluating the SKILL is definitely going to be an S expression I think.   Anyway it's passing my tests even when the result of the SKILL is a really long thing, and no file reading so it still performs well.   Seems OK for now but I'll bear in mind the idea of going via a file. Seems ugly but maybe it makes sense.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Aurel B
    Aurel B 6 days ago in reply to BS202501273649

    Do you have an example of how a long SKILL string would be passed from Python to the ipcSkillProcess interpreter?

    (what kind of string and how it's generated)

    When I said to put the data coming from Python into a file, I had in mind any generated data, not specifically SKILL code.

    In my experience it is often list of points or polygons that are processed by external programs to be highlighted inside Virtuoso. Those could become relatively big and might break the interpretation limit when passed directly, this is where using a separated file solves the issue.

    By any chance, are you using an LLM to generate SKILL code from Python and giving its output to ipcSkillProcess interpreter? If so it would make a lot of sense to have this output inside a dedicated file that you can Lint and debug afterwards.

    Otherwise, a good practice is to define in advance all the functions your external process will be able to call, and make it write simple calls to the ipcSkillProcess interpreter. That way you should never reach the limit.

    (if this case does not apply, I'd be glad to understand how and why)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • BS202501273649
    BS202501273649 6 days ago in reply to Aurel B

    As I say, it's the return of the SKILL function that can be too long.  The SKILL function requested from the Python is (as you suggest) typically just a single call.  But it can return (in theory though generally not in practice) a very long expression.   For example, in testing, I call a function which returns a list of all the numbers from 1 to n.   Once n gets big enough, then my first read only gets the first chunk (typically 64k worth) and I need to read again to get the rest.  My changed code handles that - the first chunk is not a complete S expression so it reads again and gets the rest.

    It would be nice to just require all the SKILL functions that can be called from the Python to return small results.  But this is intended to be a flexible middleware component so I can't a priori restrict the return values of the calls - I mean, I can, but it would make it less reliable and robust.

    This solution seems to be OK for now so I'm going to carry on with that.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2026 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information