Skip to content

Commit

Permalink
try better work changes attempt 2
Browse files Browse the repository at this point in the history
  • Loading branch information
m3ok committed Aug 21, 2021
1 parent d9024d7 commit 869edc8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ethash/opencl_miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,8 @@ func (c *OpenCLMiner) Seal(stop <-chan struct{}, deviceID int, onSolutionFound f
d.Unlock()

var event *cl.Event
var nfound uint32
var results []byte

cres := new(cl.MappedMemObject)

Expand All @@ -853,12 +855,11 @@ func (c *OpenCLMiner) Seal(stop <-chan struct{}, deviceID int, onSolutionFound f
}

if s.workChanged {
d.queueWorkers[s.bufIndex].EnqueueUnmapMemObject(d.searchBuffers[s.bufIndex], cres, nil)
continue
goto workchanged
}

results := cres.ByteSlice()
nfound := binary.LittleEndian.Uint32(results)
results = cres.ByteSlice()
nfound = binary.LittleEndian.Uint32(results)
nfound = uint32(math.Min(float64(nfound), float64(maxSearchResults)))

if nfound > 0 {
Expand Down Expand Up @@ -923,6 +924,7 @@ func (c *OpenCLMiner) Seal(stop <-chan struct{}, deviceID int, onSolutionFound f
}
}

workchanged:
_, err = d.queueWorkers[s.bufIndex].EnqueueUnmapMemObject(d.searchBuffers[s.bufIndex], cres, nil)
if err != nil {
d.logger.Error("Error in seal clEnqueueUnMapMemObject", "error", err.Error())
Expand Down

0 comments on commit 869edc8

Please sign in to comment.