Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Refactor to abstract device-specific code #69

Merged
merged 3 commits into from
Jan 19, 2012

Conversation

luke-jr
Copy link

@luke-jr luke-jr commented Jan 9, 2012

This creates a new, abstract device API, to make cgminer easy to extend to various/new devices. This brings various changes that were made to the GPU thread code into the CPU miner. It also fixes a bug where shares found on old GPU work were discarded when it switched to a new work. There is also a new --remove-disabled option so users can avoid interaction with other devices than the ones they choose completely.

I have tested it under both CPU mining and GPU mining, and both appear to be fully functional (including performance-wise) compared to before the refactoring.

@wizkid057
Copy link

I've been testing these modifications for over a day and it definitely works, even better than the original version.
Shares per minute increase of near 7% after testing for over 15,000 shares.

@luke-jr
Copy link
Author

luke-jr commented Jan 16, 2012

Updated with miner thread requesting its work, and hash_div (meh, it was trivial once I had the requesting in there...) readded

This expands on the device API, by taking the actual main thread out of the
device's code, and calling the API only for specific tasks. This brings
various changes that were made to the GPU thread code into the CPU miner.
It also fixes a bug where shares found on old GPU work were discarded when
it switched to a new work.
- Before, some returned bool, and others returned int (which was then turned
  into a bool with a comparison); now, everything returns a bool
- Before, some set hashes_done to nonce - 1 when a share was found and others
  set it to nonce + 1 or 2. This caused some algorithms to scan/submit shares
  twice with the new cpu_scanhash function. Now, it has all been replaced with
  last_nonce, which is set to the final nonce checked by the scanhash_* func.
- VIA needs the full data, and cannot use midstate. All the others were
  expecting midstate and data+64 for their parameters. Now, we pass midstate
  and the full data pointer, and let the scanhash_* function choose which to
  use.
@ckolivas ckolivas merged commit b9d197d into ckolivas:master Jan 19, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants