Multithreading the CULL stage

New Message Reply Date view Thread view Subject view Author view

Bernard Leclerc (bleclerc++at++cae.ca)
Fri, 29 Nov 1996 21:06:16 -0500


Is there someone out there having some experience with pfMultithread().

I'm not sure if it's a bug or a feature, but the CULL stage configuration
function declared by pfStageConfigFunc() seems to be called only once in
the CULL stage even though I configured 2 (or more) threads.

I realize here that pfStageConfigFunc() is suppose to be used to configure
a stage, not a thread. However it makes it difficult to assign a
non-degrading priority to a particular thread. It's also difficult to
isolate and restrict a CULL thread to a CPU when that thread config func
isn't called.

Here is in short my setup:

{
  pfMultiprocess(PFMP_APP_CULL_DRAW | PFMP_FORK_ISECT);
  for (int pipeNo = 0; pipeNo < numPipes; pipeNo++)
    pfMultithread(pipeNo, PFPROC_CULL, cfg.getNumThreads(pipeNo));
  pfConfig();
  pfStageConfigFunc(-1,
                    PFPROC_APP | PFPROC_CULL | PFPROC_THREAD_MASK |
                    PFPROC_DRAW | PFPROC_ISECT ,
                    stageConfigFunc);
  pfConfigStage(-1, PFPROC_APP | PFPROC_CULL | PFPROC_THREAD_MASK |
                    PFPROC_DRAW | PFPROC_ISECT );
}

static void stageConfigFunc(int pipe, uint stage)
{
  if (stage & PFPROC_DRAW)
    cpu = DRAW_CPU(pipe);
  else if (stage & PFPROC_CULL) {
    // It seems there's a bug in Performer;
    // the thread number is not encoded in the stage number.
    // This section is useless for the moment.
    pid_t pid = pfGetPID(pipe, stage);
    if (pid != getpid())
      pfNotify(PFNFY_WARN, moduleId,
               "Inconsistent PIDs: %d/%d", pid, getpid());
    int thread = (stage & PFPROC_THREAD_MASK) >> PFPROC_THREAD_SHIFT;
    pfNotify(PFNFY_DEBUG, PFNFY_MORE, "Thread %d", thread);
    cpu = CULL_CPU(pipe, thread);
  }
  else if (stage & PFPROC_APP)
    cpu = APP_CPU;
  else if (stage & PFPROC_ISECT)
    cpu = ISECT_CPU;

  sysmp(MP_RESTRICT, cpu);
  sysmp(MP_ISOLATE, cpu);
  sysmp(MP_MUSTRUN, cpu);
  pfNotify(PFNFY_INFO, moduleId,
           "Process %d running on CPU%d", getpid(), cpu);
}

I'm expecting stageConfigFunc() to be called as many times as the number
of threads on a particular pipe. Unfortunately, it's not the case.

Is this a bug?

Do you see a workaround to this "limitation"?

Thanks for any comment you could have folks.

--
Bernard Leclerc			CAE Electronics Ltd., 8585 Cote De Liesse
Technical Leader		Saint-Laurent, Quebec, Canada, H4L-4X4
3-D Graphics Applications	tel: +1 514 341 2000 extension 2275
bleclerc++at++cae.ca			fax: +1 514 340 5496
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/Performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:54:02 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.