“ Apple's proposed technology works by continuously monitoring all photos stored or shared on a user's iPhone, iPad or Mac, and notifying the authorities if a certain number of objectionable photos is detected.”
From: https://www.apple.com/child-safety/pdf/Expanded_Protections_...
“ Before an image is stored in iCloud Photos, an on-device matching process is performed for that image against the unreadable set of known CSAM hashes. “
I think it only does this before iCloud upload.